Passwords = {[1] = "pass1", [2] = "derp", [3] = "lol"} while true do term.clear() term.setCursorPos(1,1) print("Enter password") write(" > ") checkPassword = read("*") if checkPassword = Passwords[1] then print("You entered 'pass1'") sleep(3) elseif checkPassword = Passwords[2] then print("You entered 'derp'") sleep(3) elseif checkPassword = Passwords[3] then print("You entered 'lol'") sleep(3) else print("Invalid password: "..checkPassword) end end
If it does, is there an easier way to do it so you don't have to have an elseif for each password?