Been trying to work this out for hours and not getting anywhere despite lots of searching, so if somebody can help that would be great
My issue is I have a table of objects which are added like this
enemies[enemy_id] = enemy
Now when there is a collision at the end of the map I want to remove that enemy from the table. I have tried removing by
enemies[enemy_id] = nil
But when it gets to the last enemy the table is already empty for some reason. Say there's 3 enemies in a table, I print the count of the table. The first one is removed it shows 2 left, 2nd is removed it shows 0 left. Doesn't make sense
So how do you remove an item from a table? I have also tried table.remove but I need to key the same keys because they are the id of the enemy. I can post an example if need be
#ton sparse tables (when indices have gaps), it returns wrong result. - Egor Skriptunoff