A very basic question I guess. Is there any way to destruct an image object. What I wanna do is destroy an image object when I press a button. I have managed to do it by reinitializing the same object ( keeping the object name same) but I don’t know if that’s the best way to do.
As far as I’m aware, you should just be able to set the variable that holds the image to ‘nil’. Once an object becomes ‘unreachable’, it’ll be cleaned up by Lua’s garbage collector.
I may be wrong, though!
No, that’s correct. Just set the image to nil, make sure it’s not being referenced from anywhere, and it will get cleaned up.
That’s pretty easy. Thanks a lot Frosty and Simeon.