Jump to content




This Doesnt Seem To Run


3 replies to this topic

#1 libraryaddict

  • New Members
  • 195 posts

Posted 18 February 2012 - 02:06 AM

Posted Image
Its a form of http://www.computerc.../100-door-lock/

Im new to computer craft.

I get a error "[string "lock"]:7: ')' expected"

Thanks

#2 Advert

    Custom Title

  • Moderators
  • 459 posts
  • LocationLondon

Posted 18 February 2012 - 02:27 AM

View Postlibraryaddict, on 18 February 2012 - 02:06 AM, said:

Posted Image
Its a form of http://www.computerc.../100-door-lock/

Im new to computer craft.

I get a error "[string "lock"]:7: ')' expected"

Thanks

You need to call read, not assign it:
input = read("*")

You also need to use commas (,) to seperate arguments to functions:

rs.setOutput("left", true)

I'd recommend you read this: http://www.lua.org/pil/index.html
It's a great resource for getting started with Lua.

#3 arongy

  • New Members
  • 37 posts
  • LocationQuebec, Canada

Posted 18 February 2012 - 08:18 AM

And it should be
input == pass


#4 RoD

  • Members
  • 313 posts

Posted 28 June 2013 - 02:29 PM

The whole code should look like
pass = "password"
write "password: "
input = read("*")
if input == pass then  -- if you didnt assign open to anything so you can't use it
print "welcome!"
redstone.setOutput("left", true)--dont forget the comma
sleep(3.5)
redstone.setOutput("left", false)
else
print "Awww :(/>"
sleep(1)
os.reboot()
end






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users