我是第一次查看 PICO-8。
这个简单的 IF 语句给我错误“UNCLOSED FUNCTION AT LINE 1”。
function MYTEST()
local x = 1
if x==1 then
print("x==1")
else if x==0 then
print("x==0")
end
end
我承认这个函数没有用,但是解释器不允许它运行。
为什么?
最佳答案
正如评论中提到的,将代码从 else if
更改为 elseif
即可使其工作。
或者,在第一个 end
之前添加 end
:
function MYTEST()
local x = 1
if x==1 then
print("x==1")
else if x==0 then
print("x==0")
end
end
end
关于lua - IF ELSE IF END 给出未闭合函数错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47761705/