Jump to content




bios:338: [string "startup"]:27 'end' expected


  • You cannot reply to this topic
7 replies to this topic

#1 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 23 February 2013 - 12:21 AM

Hi! I'm Trying to make a login program. But When i try to run it i get this error: bios:338: [string "startup"]:27 'end' expected (to close 'if' at line 13) how do i fix it? Heres My code:

local pullEvent = os.pullEvent

os.pullEvent = os.pullEventRaw


local scode = "1525"

local code = "8126"

local out = "back"

local time = 5



term.clear()

term.setCursorPos(1,1)

write("Please input code> ")

local input = read("*")

if input == code then
t
term.clear()

term.setCursorPos(1,1)

print("Correct code!")

rs.setOutput(out, true)

sleep(time)

rs.setOutput(out, false)

os.reboot()

else

term.clear()

term.setCursorPos(1,1)

print("Incorrect code!")

sleep(2)

os.reboot()

elseif input == scode then

os.pullEvent = pullEvent

print("You can terminate the program now")

end

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 23 February 2013 - 04:27 AM

Split into new topic.

Your elseif clause needs to be before your else clause.

#3 Mads

  • Members
  • 604 posts
  • LocationCopenhagen, Denmark

Posted 23 February 2013 - 09:17 AM

Use pastebin or something damnit. Most people don't even bother reading your code if it's not formatted.

#4 exploder

  • Members
  • 69 posts
  • LocationLatvia

Posted 23 February 2013 - 09:52 AM

Lyquid already told you what to do, but in case you don't understand here is the fixed code, just copy%paste it.

local pullEvent = os.pullEvent
os.pullEvent = os.pullEventRaw
-- [[ Variables ]] --
local scode = "1525"
local code = "8126"
local out = "back"
local time = 5
-- [[ Main Part ]] --
term.clear()
term.setCursorPos(1,1)
write("Please input code> ")
local input = read("*")
if input == code then
  term.clear()
  term.setCursorPos(1,1)
  print("Correct code!")
  rs.setOutput(out, true)
  sleep(time)
  rs.setOutput(out, false)
  os.reboot()
elseif input == scode then
  os.pullEvent = pullEvent
  print("You can terminate the program now")
else
  term.clear()
  term.setCursorPos(1,1)
  print("Incorrect code!")
  sleep(2)
  os.reboot() 
end

And next time please format your code correctly, and use pastebin or code (<>) option in the editor.

#5 LBPHacker

  • Members
  • 766 posts
  • LocationBudapest, Hungary

Posted 23 February 2013 - 10:08 AM

Formatted and bugfixed version of the code:
Spoiler

Code that I prefer to use:
Spoiler

EDIT: Yay ninja'd

#6 Lewis.holcombe

  • Members
  • 12 posts

Posted 24 February 2013 - 10:02 AM

Don't want to sound like an idiot. But shouldn't the 3rd to last line be
os.pullEvent = os.pullEventRaw

#7 LBPHacker

  • Members
  • 766 posts
  • LocationBudapest, Hungary

Posted 24 February 2013 - 11:31 AM

 Lewis.holcombe, on 24 February 2013 - 10:02 AM, said:

Don't want to sound like an idiot. But shouldn't the 3rd to last line be
os.pullEvent = os.pullEventRaw

Nope. With os.pullEvent = pullEvent, he restores the good old os.pullEvent, because it points to os.pullEventRaw before that.
pullEvent (not os.pullEvent but pullEvent) is declared on the 1st line, and it points to the old os.pullEvent.

#8 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 25 February 2013 - 07:16 PM

Thanks for The help!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users