I have this code:
local storyboard = require "storyboard"
local options =
{
effect = "slideLeft",
time = 800
}
storyboard.gotoScene( "scene1", options )
In the same directory I have a file named "scene1.lua", but console reports this error:
attempt to concatenate global 'sceneName' (a nil value) in function 'gotoScene'
Any idea because happen this? Thanks
I found the solution:
In scene1.lua must be have the following methods and eventListeners:
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
function scene:createScene( event )
end
function scene:enterScene( event )
end
function scene:exitScene( event )
end
function scene:destroyScene( event )
end
scene:addEventListener( "createScene", scene )
scene:addEventListener( "enterScene", scene )
scene:addEventListener( "exitScene", scene )
scene:addEventListener( "destroyScene", scene )
return scene
You were just missing
return scene
in your scene1.lua file. Scene functions are all optional.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With