Advertisement
BOF007

CC PW protector

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