Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var password = "secret" --Change this to your password
- print "This computer is password locked." -- Writes a message to the screen then moves to next line
- var input = nil -- Define input before loop so that an error doesn't get thrown
- while input~=password do -- Loops the following statement until the user enters the correct password
- write "Password: " -- Writes 'Password: ' to the screen, it also will not change the cursor pos
- input=io.read('*') -- Gets input from user while hiding their input with the '*' character
- if input~=password then -- Checks to see if the inputted text doesn't match the password
- print "Incorrect Password!" -- Tells user that they entered wrong password
- end
- end
- print "Correct Password!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement