Luoop - Lua oop library

I see your point yep. You could still have issues with specific cases where Corona destroys a display group / object completely bypassing your whole system though and you would have to make sure that the display object’s state is tracked properly / tested for validity. That’s the idea though, having a getDisplayObject() method or whatever method to wrap around the “native” corona display group.

Can Corona delete display objects on its own ? I think StoryBoard/Composer can garbage collect stuff but I don’t use that.

Nope it can’t (I hope !) unless you have inserted it in another display object / group

How would you go about inserting these child objects into a display group? 

That’s the main limitation of objects you create that way.
The corona display group system will definitely “not” call your object destroy function to make sure memory is freed, and you cannot “insert” them as such since they aren’t corona display objects.

In this case, it’s better to consider the luoop view object as a wrapper around a corona display group.
You could hijack the removeSelf function to make it call the destructor automatically but you would still have the issue when there is a hierarchy of corona display groups / objects - parent groups seem to call an internal display cleanup function different to removeSelf()

Conclusion is: Either use a whole luoop stack and wrap your groups inside them, or use luoop for the model / controller objects only if it is an issue

 

I’ve my own entirely different system which has destructors (non automatic obviously) and I think the latter is the solution. Objects are used for game scenes, some abstract display objects, resources etc. but the actual Corona flat implementation of objects displays as is. 

Objects that need their displays manipulated (e.g. game scenes so the game manager can do state changes fade in/out etc.) have a getDisplayObject() method.

Banjaxing around with Corona SDK is generally not a good idea - I don’t even recommend basic decoration because Corona could add methods to the API. 

I think it introduces unnecessary complexity anyway. 

In my system if you have an object that (say) represents a score display the actual implementation is hidden in the object, built up by the constructor and torn down by the destructor. It allows some automation - the object can be added to the scene in such a way that when the scene is destroyed its child objects are too, but the actual Corona tear-down is still done the same old fashioned way.

I see your point yep. You could still have issues with specific cases where Corona destroys a display group / object completely bypassing your whole system though and you would have to make sure that the display object’s state is tracked properly / tested for validity. That’s the idea though, having a getDisplayObject() method or whatever method to wrap around the “native” corona display group.

Can Corona delete display objects on its own ? I think StoryBoard/Composer can garbage collect stuff but I don’t use that.

Nope it can’t (I hope !) unless you have inserted it in another display object / group