This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
jjr2000's profile picture

[Lua][ERROR] bios:206: [string "ok"]:15 'end' expected (to close 'if' at line 9)

Started by jjr2000, 03 December 2012 - 04:35 AM
jjr2000 #1
Posted 03 December 2012 - 05:35 AM
ok im having a problem where im getting the following error in lua scripting bios:206: [string "ok"]:15 'end' expected (to close 'if' at line 9)
so im wondering if you know how to fix it because he is the coding that im using

http://pastebin.com/BzdYpJ5k

which i call the scrip ok

and my startup scrip is

print ("welcome")
shell.run("ok")

which is working fine so is there any suggestions on how to get my script to work
sjele #2
Posted 03 December 2012 - 05:37 AM
In lua if statements require an end.

if this == that then
  DoThat()
elseif this == dat then
  DoDat()
else
  DoWhatEver()
end
jjr2000 #3
Posted 03 December 2012 - 06:06 AM
ok i updated my script but now i get a close 'if' at line five i updated the pastebin so its still the same link to the updated scrip
so any help would be appretiated :)/>
Doyle3694 #4
Posted 03 December 2012 - 06:14 AM
elseif is 1 word ;)/>

And if you want to set something to a string you use "" or '', so yogscast = yogscast would be yogscast = "yogscast"
jjr2000 #5
Posted 03 December 2012 - 06:31 AM
ok i updated the script again but it for some resone it isnt waiting for an input so do you no how to get it to wait for an input
Doyle3694 #6
Posted 03 December 2012 - 06:33 AM

yogscast = "yogscast"
close = "close"
print ("jrabba_co.os")
print ("please enter password")
input = read("*")
if input == yogscast then
   print ("correct password")
   shell.run("yogscast")
elseif input == close then
   print ("ok")
   shell.run("close")
else
   print ("incorrect password")
   sleep(2)
   os.shutdown()
end
jjr2000 #7
Posted 03 December 2012 - 06:50 AM
thank you it works