我有这个代码:
local storyboard = require "storyboard" local options = { effect = "slideLeft",time = 800 } storyboard.gotoScene( "scene1",options )
在同一目录中,我有一个名为“scene1.lua”的文件,但是控制台报告此错误:
attempt to concatenate global 'sceneName' (a nil value) in function 'gotoScene'
任何想法,因为发生这个?谢谢
解决方法
我找到了解决方案:
在scene1.lua中必须有以下方法和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