Removing an array key (with value)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-07-12
06:20 PM
- last edited on
2021-09-14
09:00 AM
by
Noemi Balogh
2021-07-12
06:20 PM
Hi
As a dictionary key can be removed using the function REMOVEKEY (dictionary.key), is there a way to remove an array's key (with value)?
I tried:
Thanks
As a dictionary key can be removed using the function REMOVEKEY (dictionary.key), is there a way to remove an array's key (with value)?
I tried:
myDict.myArray[1] = 1 REMOVEKEY(myDict.myArray[1])but that does not seem to remove it.
Thanks
Labels:
- Labels:
-
Library (GDL)
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-07-12 11:57 PM
2021-07-12
11:57 PM
Sadly, there is no native way to delete/pop items from an array. This makes it necessary to do a bit of juggling.
dim arr[] arr[1] = 0.1 arr[2] = 0.2 arr[3] = 0.3 ! index of the item you want to delete todelete = 2 dim new_arr[] check = 0 for i = 1 to vardim1(arr)-1 if i = todelete then check = 1 new_arr = arr[i+check] next i arr = new_arr print arr !>>> will print: "0.1 0.3"
Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Akroter.io – high-end GDL objects | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text
My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |
POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |
POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-07-13 06:24 AM
2021-07-13
06:24 AM
Hi runxel
Ok, I get the idea. Thanks a lot!
Ok, I get the idea. Thanks a lot!