Posted 04 May 2012 - 02:41 AM
I'm coding a simple text password lock for my elevator, i need help with assigning more than one string to my variable.
I just started lua and computercraft so please try to be patient with me
What i want is to beable to type the password as either "sponge" or "Sponge" in my terminal, and to beable to type either "hint" , "Hint" or "<hint>" and for it to recognize as the hint.
i've tried:
I just started lua and computercraft so please try to be patient with me
PASSWORD = "Sponge"
HINT = "What you wash things with."
textutils.slowWrite("Type in the PASSWORD, or type <hint>.")
input = read()
if input == PASSWORD then
print("password accepted.")
sleep(2)
os.shutdown()
elseif input == "hint" then
print(HINT)
sleep(2)
os.shutdown()
else print("denied.")
sleep(3)
os.shutdown()
end
What i want is to beable to type the password as either "sponge" or "Sponge" in my terminal, and to beable to type either "hint" , "Hint" or "<hint>" and for it to recognize as the hint.
i've tried:
elseif input == "hint" or "Hint" or "<hint>" then...
and
h = "hint"
s = "Hint"
h == s
elseif input == s then...
with no luck, thank you in advance