local obj = {}
obj.id = 0
obj.increase = function()
obj.id = obj.id + 1
end
obj.print = function()
print(obj.id)
end
I added a destroy function:
local obj = {}
obj.id = 0
obj.increase = function()
obj.id = obj.id + 1
end
obj.print = function()
print(obj.id)
end
obj.destroy = function()
obj.id = nil
obj.increase = nil
obj.print = nil
obj.destroy = nil
end
Do I need a destroy function? When I set to obj = nil does GC remove all variables and methods in obj? [import]uid: 5629 topic_id: 24207 reply_id: 324207[/import]
So these two lines remove obj group and its sub display objects. Then setting all the sub objects and methods to nill right? [import]uid: 5629 topic_id: 24207 reply_id: 97733[/import]