I have a table full of rectangles, like so:
[lua]local rectanglez = {}
–Simplified original function greatly; this code isnt tested
for i,4 do
rectanglez[i] = display.newRect(0,0,20,20)
rectanglez[i].x = i *30
rectanglez[i].y = i * 30
localGroup:insert(rectanglez[i])
end[/lua]
And lets say I want to eventually “nuke” every rectangle in that array:
[lua]–Actual function
function nukeTable(someGroup,someTable)
print(“Go nuke table”)
for i=#someTable,1,-1 do
local item = someTable[i]
if item.parent then
item.parent:remove(item)
– item.removeSelf()
item = nil
end
table.remove(someTable,i)
someTable[i] = nil
end
end
–At some point later in my code, I call the above using the following
nukeTable(localGroup,rectanglez)[/lua]
The above function seems to be working right now. My rectangles disappear from the screen and everything seems legit. I just want to make sure there’s no other additional steps I need to take to clear out the stuff from memory. Someone also suggested that I try the “removeSelf” function, but I have it commented out because I must not be using it right (it causes my application to crash). As always, any input is greatly appreciated 
Cheers!
[import]uid: 52208 topic_id: 21836 reply_id: 321836[/import]