im trying to make a program for a lua based computer in a game. Although when its run it acts weird
--Tablet
oldpullEvent = os.pullEvent
os.pullEvent = os.pullEventRaw
while true do
term.clear()
term.setTextColor( colors.white )
term.setCursorPos(1, 1)
print("Please Enter Password:")
input = read("*")
incorrect = 0
while incorrect < 3 do
if input == "qwerty" then
print("Password Correct, Unlocking")
else
if incorrect < 3 then
incorrect = incorrect + 1
print("Password incorrect")
print(3 - incorrect, " tries remaining")
else
print(3 - incorrect, "tries remaining, locking phone for 1m")
local num = 0
while num < 60 do
if num < 60 then
term.clear()
term.setTextColor( colors.red )
term.setCursorPos(1, 1)
num = num + 1
print(60 - num, "s remaining")
sleep(1)
else
incorrect = 0
end
end
end
end
end
end
os.pullEvent = oldpullEvent
When it runs it starts with "Please enter password:" upon entering "qwerty" the password it wants, it loops "Password Correct, Unlocking" over and over infinitly. when I enter an incorrect password it doesnt run any of the code in the else statement and just returns back to the enter password screen. no error codes or crashes. Does anybody who know lua know if I wrote my while/if/elseif functions wrong or a work around.
Thanks!