Jump to content




"eof" expected error


  • You cannot reply to this topic
1 reply to this topic

#1 deadcrypt

  • New Members
  • 1 posts

Posted 20 November 2015 - 02:28 PM

heres the code please escuse my bad indenting

while true do
  term.clear()
  term.setCursorPos(1, 1)
  print("please enter your login information")
  sleep(1)
  print(" ")
  print("Username:")
  local yourinput = read()
  if input == "Test" then end
  print("Password:")
  sleep(0)
  input = read("*")
  if input == "Test" then end
  redstone.setOutput("back", true)
  print("Information correct")
  sleep(2)
  os.reboot()
end
else
print("Intruder detected sounding alarms")
sleep(1)
redstone.setOutput("right", true)
sleep(10)
redstone.setOutput("right", false)
sleep(1)
os.reboot()
end
end



#2 Lupus590

  • Members
  • 2,028 posts
  • LocationUK

Posted 20 November 2015 - 04:32 PM

eof means end of file

as an error, it means that you have too many ends.

Indenting your code properly helps a lot, I also commented your ends, so that you can see which one ends what. additionally I moved some of your ends onto a separate line

while true do
  term.clear()
  term.setCursorPos(1, 1)
  print("please enter your login information")
  sleep(1)
  print(" ")
  print("Username:")
  local yourinput = read()
  if input == "Test" then
    --#stuff to do in if goes here
  end --#if
  print("Password:")
  sleep(0)
  input = read("*")
  if input == "Test" then
    --#stuff to do in if goes here
  end--#if
  redstone.setOutput("back", true)
  print("Information correct")
  sleep(2)
  os.reboot()
end --#while
else --#this should cause a problem, as you have ended your if statements already
print("Intruder detected sounding alarms")
sleep(1)
redstone.setOutput("right", true)
sleep(10)
redstone.setOutput("right", false)
sleep(1)
os.reboot()
end --#nothing to end
end --#nothing to end

Edited by Lupus590, 20 November 2015 - 04:33 PM.






2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users