139 posts
Location
Vilnius,Lithuania
Posted 13 March 2013 - 12:04 AM
My code:
write("Password: ")
if input == start then
print("Booting System")
2088 posts
Location
South Africa
Posted 13 March 2013 - 12:30 AM
input = read()
if input == "start" then
11 posts
Posted 13 March 2013 - 12:44 AM
um…
Use this as a base….
http://pastebin.com/2w0JZ9QJor
http://pastebin.com/W9yH2c10If you use the "debug" code as the main input then it will work fine for your needs.
7508 posts
Location
Australia
Posted 13 March 2013 - 02:25 AM
write("Password: ")
local input = read()
if input:lower() == 'start' then
print("Booting System")
else
print("Goodbye")
os.shutdown()
end
58 posts
Location
Seattle
Posted 14 March 2013 - 06:02 AM
write("Password: ")
local input = read()
if input:lower() == 'start' then
print("Booting System")
else
print("Goodbye")
os.shutdown()
end
What does the :lower() do?
8543 posts
Posted 14 March 2013 - 06:05 AM
Since input is a string, it's syntactically equivalent to `string.lower(input)`, which converts all upper-case letters to lower-case letters. You can guess what string.upper does.
7508 posts
Location
Australia
Posted 14 March 2013 - 06:46 PM
To expand on what Lyqyd said, its so that even if they enter it like StARt it will still work because it is converted to lower case before checking what they typed.