我是Lua的新手,我多次得到这个错误“'结束'预期(关闭'而在第3行')附近''”我已经检查过在网上找到答案但没有运气所以我是希望有人能帮我解决这个问题,非常感谢
这是我的代码:
print ("Welcome to the maze")
while input ~= "leave" do
print ("What do you want to do first? Leave or inspect?")
input = io.read()
if input == "inspect" then
print (" You venture towards the maze.")
end
if input == "leave" then
print ("You turn around and run.")
end
答案 0 :(得分:6)
我从未见过lua,但我认为阅读错误将是解决方案:
'端'预期(关闭'而第3行)
所以我需要将end
放到代码中:
print ("Welcome to the maze")
while input ~= "leave" do
print ("What do you want to do first? Leave or inspect?")
input = io.read()
if input == "inspect" then
print (" You venture towards the maze.")
end
if input == "leave" then
print ("You turn around and run.")
end
end