i am running this code
function start()
print("password required to open")
a = read()
if a == "password" then
print ("accewss Granted")
rs.setOutput("right.true)
else
print ("access denied")
rs.setOutput("left", true)
sleep(3)
os.shutdown
end
what am i doing wrong? i gives me a bios:206: [string "startup"]:13: '=' expected when i start up please help!
bios:206: [string "startup"]:13: '=' expected
Started by rjqg327, Jun 28 2012 02:46 AM
2 replies to this topic
#1
Posted 28 June 2012 - 02:46 AM
#2
Posted 28 June 2012 - 03:06 AM
After formatting your code, your error wasn't hard to track down:
Also, since you defined this as a function, you'll need to add:
function start()
print("password required to open")
a = read()
if a == "password" then
print ("Access Granted") --Minor spelling error
rs.setOutput("right", true) --Corrected code, unfinished string, nil function call: rs.setOutput("right", true). I did not even notice this until posting it in the forum, as the rest of the program became green. right.true is not a function, you put a period instead of a comma. Lastly, forgot to close the string, "right", by adding a quotation mark at the end.
else
print ("Access Denied") -- Capitalized words
rs.setOutput("left", true)
sleep(3)
os.shutdown
end --Forgot to close 'if' statement, or function. In short, you left out one 'end'.
end
Also, since you defined this as a function, you'll need to add:
start()At the end of all the code to call the function or else after the computer starts up, it'll just go to the shell and not do anything.
#3
Posted 28 June 2012 - 04:34 AM
os.shutdown() instead of os.shutdown.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











