Liam Kelly
Liam Kelly

Reputation: 23

lua <eof> expected near end

I'm trying to make a keycard door in minecraft using computercraft and it gives me an error at line 23 saying expected

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

Upvotes: 2

Views: 3496

Answers (1)

cfillion
cfillion

Reputation: 1398

There is an extra end after the break at line 14. It closes the conditional block prematurely. You are getting this error message because the end at the bottom of the file has nothing to close.

Upvotes: 4

Related Questions