Hi,
I spawn and remove objects in my game and it runs fine as I get their collision handle and call removeSelf and nil upon them and it’s fine but at certain situations I need to remove all those objects that I spawned so I have to store their references in some data structure, and in Lua I believe it’s a table, so I can call removeSelf and nil them.
Problem is, I can’t get my head around doing it. I used several methods and used several things as keys, even added a custom string as key and then used ipairs to retrieve them but it just won’t work. Because all iterators apparently require an index at 1 but I may have removed object at that 1 index previously.
So to sum it up, how can I store objects into a table, have a proper key to find them and easily be able to remove (and by remove I mean three things 1) calling removeSelf upon it 2) assigning nil to it and 3) removing it from that table object holding it’s reference) any of them or all of them at once?
Thanks. [import]uid: 206803 topic_id: 36808 reply_id: 336808[/import]