I’m trying to do cleanup on an entire level of a game. Some of the display objects are created via display.newImage, but some are created via display.newGroup.
When I go through the tables and delete everything like this:
for i in pairs (enemies) do
enemies[i]:removeSelf();
enemies[i] = nil;
end
That works if the enemy is just an image, but throws an error if it is a more complex group object (attempt to call method ‘removeSelf’ (a nil value)). So I need to know how to determine if an enemy is a group or not, and how to destroy it if that is the case. [import]uid: 52127 topic_id: 10142 reply_id: 310142[/import]