Some of this is specific to Gideros and some might be related to lua in general but I was wondering about cleaning up an object derived from sprite which uses physics after I'm done with it.
My sprite currently has the following objects related to it:
shape, bitmap - local only to the init function
body, fixture - properties of the object
I'm currently destroying the fixture and then the body and removing the sprite from the parent. Is this enough to avoid memory leaks or do I need to do something else to fully dispose of the object.
The game doesn't keep track of the sprites and they are self contained so there are no references to the object outside of itself.
Comments
Yes, this is absolutely enough. Also you don't need to destroy the fixture. When you destroy the body, the fixtures attached to it are destroyed automatically. Even you don't need to keep a reference to the created fixture.