If I have a global function on a display object, how do I or do I need to manually set it to nil after calling removeSelf() ?
[lua]local displayObject = display.newImage(“something.png”)
function displayObject:render()
– does something
end
displayObject:removeSelf??[/lua]
Do I need to set render() to nil? If so how do I do that?
Just reading in another topic a post by ANSCAs Tom, he said that when you remove an Displayobject, it turns into a table. Any custom data (Your function) to that former Displayobject is still there. To remove it, I would say either try what you already posted or if you don’t need that table, set it to nil. [import]uid: 5712 topic_id: 2273 reply_id: 6868[/import]
I believe the rule is if the object is “reachable” then it will stay around in memory and not be GC’d. If you set displayObject = nil (after removeSelf), the object and function are no longer reachable and should go away.