Lua ';结束';预计在';附近(在第3行';关闭';)&书信电报;eof>';

Lua ';结束';预计在';附近(在第3行';关闭';)&书信电报;eof>';,lua,Lua,我是Lua的新手,我多次遇到这个错误“'end'预计(在第3行关闭'while')在'”附近。我已经在网上查找答案,但运气不好,所以我希望有人能帮我解决这个问题,非常感谢 这是我的密码: print ("Welcome to the maze") while input ~= "leave" do print ("What do you want to do first? Leave or inspect?") input = io.read() if inpu

我是Lua的新手,我多次遇到这个错误“'end'预计(在第3行关闭'while')在'”附近。我已经在网上查找答案,但运气不好,所以我希望有人能帮我解决这个问题,非常感谢

这是我的密码:

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

我从未见过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

我从未见过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

尝试在while循环体“”表示“文件结束”的末尾添加“end”关键字。因此,该消息意味着您的代码在此之前满足了所有语法规则。请尝试在while循环体“”的末尾添加一个“end”关键字“”表示“文件结束”。所以,这个消息意味着你的代码满足了所有的语法规则,直到那个时候。这真的是我需要做的全部吗?我花了大约4个小时来处理代码。。。非常感谢,巴德。我真的很感激。我希望就是这样,请给我一个反馈,否则我也可以试试lua;)没问题-如果您不知道,您可以将我的答案标记为解决方案:)我该怎么做?我对这个网站也很陌生。啊,很高兴听到你这么说,我有一个新的错误,我能给你发个人信息吗?我真的需要这么做吗?我花了大约4个小时来处理代码。。。非常感谢,巴德。我真的很感激。我希望就是这样,请给我一个反馈,否则我也可以试试lua;)没问题-如果您不知道,您可以将我的答案标记为解决方案:)我该怎么做?我对这个网站也很陌生。啊,很高兴听到你这么说,我有一个新的错误,我能给你发个人信息吗?