Hi all,
In a scene, I defined a table (otside of the Scene event functions) as follows:
local t = {}
In the scene:show event, I add newSprites to the table in a loop.
t[i] = = display.newSprite( sceneGroup, t\_sheet, t\_sequence )
In the scene:hide I try to destroy them as follows:
for k, v in pairs(t) do v:removeSelf() v = nil end
This works most of the time, but occasionally I get:
attempt to call method 'removeSelf' (a nil value)
I am thinking that maybe removing the objects inside the loop leads to the pairs function getting confused. Am I right?
Is there a better way to do this?