I am trying to create a reload function.
camera:destroy() composer.gotoScene( "scenes.levels.1", { effect = "fade", time = 250 } ) composer.removeScene( name )
Then at the top:
camera = perspective.createView()
After I load the scene again I get this error message.
perspective.lua:201: attempt to call method 'insert' (a nil value)
I tried debugging and the problem is with the layer number:
function view:add(obj, l, isFocus) print(l)
The code works perfectly when creating the level the first time, but breaks when trying to restart level.
Thanks.