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

This Doesnt Seem To Run

Started by libraryaddict, 18 February 2012 - 01:06 AM
libraryaddict #1
Posted 18 February 2012 - 02:06 AM

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

Im new to computer craft.

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

Thanks
Advert #2
Posted 18 February 2012 - 02:27 AM

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.
arongy #3
Posted 18 February 2012 - 08:18 AM
And it should be
input == pass
RoD #4
Posted 28 June 2013 - 03: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