Hi there,
so I have a mod which creates some display objects and text objects.
It’s called mod_textbox.lua.
When I am working with the composer I have to insert ALL objects into the “sceneGroup”.
So I understood it so that all this objects that are inside the “sceneGroup” will be automatically deleted when the scene is in the phase “destroy” when I am changing the scene.
But how about the objects in the module ?
The mod of course doesn’t have the composer with the sceneGroup.
So I tried it like this:
I insert all the objects inside the mod into a new group in the mod.
Then I insert this mod group (lets call it “textGroup”), inside the “sceneGroup” in the scene.lua which has required the mod_textbox on the top.
local textBox = require( “mod_textbox” )
sceneGroup:insert(textBox.textGroup)
This way I thought the objects will be destroyed.
But it isn’t so.
For example, when the mod has created a text object and I see some text and I change the screen, the text object is still there.
I also tried to remove the mod from package.loaded when changing the scene, but it doesn’t work too.
So how can I remove objects that are created inside a mod when I am changing the scene ?
Thanks in advance and best regards!
Dima