local purgeGroup = display.newGroup() display.newCircle( purgeGroup, 10, 10, 10 ) display.newCircle( purgeGroup, 10, 20, 10 ) display.newCircle( purgeGroup, 10, 30, 10 ) display.remove(purgeGroup) -- All 3 circles are gone.
Hey, I understand. This is what I think of as long-hand or train-of-thought code. I get it.
It would benefit a lot from modularization and a reduction in the use of tables. If you don’t need to track an object for updating or examination, don’t put it in a table. Just put it in a display group.
Then, you can destroy the display group later to destroy all objects in that group.
Finally, you should be left with one or two tables that are tracking objects. You can simply set the references to those tables to nil and viola you’re done.
thanks! really helps!!