【问题标题】:lua <eof> expected near endlua <eof> 预计接近尾声
【发布时间】:2019-08-28 14:43:30
【问题描述】:

我正在尝试使用 computercraft 在 minecraft 中制作一个钥匙卡门,但它在第 23 行给我一个错误,说是预期的

rs.setOutput("bottom", true)
while true do
  if disk.isPresent("top") then
    if fs.exists("disk/.cardauth/authkey") then
      f = fs.open("disk/.cardauth/authkey", "r")
      p = f.readAll()
      if p == "UDoFk6ErYM" then
        disk.eject("top")
        rs.setOutput("bottom", false)
        sleep(4)
        rs.setOutput("bottom", true)
      elseif p == "QmwZNWQsxFug6SMOYQnh" then
        disk.eject("top")
        break end
      else
        disk.eject("top")
      end
    else
      disk.eject("top")
    end
  end
  sleep(0.1)
end

【问题讨论】:

  • disk.eject("top") 在你逻辑的每个分支中。您可以放心地将它放在disk.isPresent("top") 正文的末尾。

标签: lua computercraft


【解决方案1】:

在第 14 行的break 之后有一个额外的end。它会提前关闭条件块。您收到此错误消息是因为文件底部的 end 没有可关闭的内容。

【讨论】:

    猜你喜欢
    • 2016-06-27
    • 1970-01-01
    • 2014-06-03
    • 1970-01-01
    • 2014-03-14
    • 1970-01-01
    • 2015-01-24
    • 2015-02-18
    • 2014-06-04
    相关资源
    最近更新 更多