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

really weird problem

Started by horseshoecrab, 04 August 2012 - 08:12 PM
horseshoecrab #1
Posted 04 August 2012 - 10:12 PM
when I try to use this program, it expects "=" but when i do that, is says "unexpected symbol"
help plz.


write("Input Password")
pass = read()
if pass = (corectpass) then
write("password=true")
redstone.setOuput("left",true)
sleep(5)
os.shutdown
else
write("password=incorrect")
sleep(2)
os.shutdown
end
MysticT #2
Posted 04 August 2012 - 10:18 PM
Fixed and commented code:

write("Input Password: ")
local pass = read("*") -- the "*" will hide the input and show it like ****
if pass == "ThePassword" then -- when comparing, you need to use == instead of =
  write("password=true")
  redstone.setOutput("left", true)
  sleep(5)
  os.shutdown() -- you need to put () to call a function
else
  write("password=incorrect")
  sleep(2)
  os.shutdown() -- same as above
end
horseshoecrab #3
Posted 05 August 2012 - 03:21 PM
thank you so much.