hey guys i ran into a little problem, i am spawning some objects on screen but when i try to rest the game scene from the win scene the objects i am try to spawn doesn’t rest them. i believe this problem pop up because i am not inserting the objects into a group so when the scene change the objects/ table destroy himself. also the coinsTable is in my create scene, try to insert the table by doing this
But why are you doing it at all? coins is a table of your display objects. coinsTable is your list of filenames. I don’t see why you need to do this. If it does what you think, then you end up with objects in coins that are not display.newImageRects() and you’re trying to manipulate them like display objects.
Well it depends on a lot of factors. In your case of your table of file names, no you don’t need to empty it. It’s almost like constants. Depending on how you’re doing your scenes, it may get unloaded when the scene is removed. Generally a table like that is so little data you don’t have to worry about it.
Now your table of coins, each entry contains a display object that those display objects eat up large chunks of memory. Those need to be removed and nil’ed when you are done with them.
Be aware if you nil the entry in the table:
display.remove(coins[4])
coins[4] = nil
#coins will equal 3 even though you may 100 of them. There is a function table.maxn(coins) will return the true length of the table. Using #coins (and #coins+1) works as long as there are no nil members.
But why are you doing it at all? coins is a table of your display objects. coinsTable is your list of filenames. I don’t see why you need to do this. If it does what you think, then you end up with objects in coins that are not display.newImageRects() and you’re trying to manipulate them like display objects.
Well it depends on a lot of factors. In your case of your table of file names, no you don’t need to empty it. It’s almost like constants. Depending on how you’re doing your scenes, it may get unloaded when the scene is removed. Generally a table like that is so little data you don’t have to worry about it.
Now your table of coins, each entry contains a display object that those display objects eat up large chunks of memory. Those need to be removed and nil’ed when you are done with them.
Be aware if you nil the entry in the table:
display.remove(coins[4])
coins[4] = nil
#coins will equal 3 even though you may 100 of them. There is a function table.maxn(coins) will return the true length of the table. Using #coins (and #coins+1) works as long as there are no nil members.