gpt4 book ai didi

lua - 电晕: Attempt to concatenate global 'sceneName'

转载 作者:行者123 更新时间:2023-12-04 04:51:55 25 4
gpt4 key购买 nike

我有以下代码:

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

关于lua - 电晕: Attempt to concatenate global 'sceneName' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14057440/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com