I require some modules in different scenes, like this for example:
-- mymodule.lua local mod={} local gfx={circle,rect} local createobj=function(group) gfx.circle=display.newCircle(0,0,20) gfx.rect=... group:insert(gfx.circle) group:insert(gfx.rect) end mod.gfx=gfx mod.createobj=createobj return mod
Now I have more than one scene or even other modules which are requiring this module above.
An example
the scene myscene1.lua is requiring the module AND another module which is also requiring the module above!
So the module above is required multiple times in one working scene (myscene1.lua)
Now when the scene is changing to another scene I want to free the memory correctly and I wonder if I have to keep track of all the places where the module was required and have to remove the graphics objects more than once (because the module was required on different places in the code)?
Or is it enough to delete the gfx table content once when the scene is changing?