Hi guys, in my game I need to remove all the objects contained inside a specific table using a for cycle inside a runtime function.
The code I’m actually using (which doesn’t work) is the following:
local function cambioScenario() if(immaginiCambioScenario[1].x\<0)then for i=0, 16 do newYork[i]:removeSelf() newYork[i] = nil end end end Runtime:addEventListener("enterFrame", cambioScenario)
The code above returns the following error:
game.lua:10366: attempt to index field '?' (a userdata value)
Where line 10366 is “newYork[i]:removeSelf()”
By the way, if the for cycle is executed when a Touch Event occurs everything works.
Have you got any suggestions?
Thanks in advantage 