Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local password = "wasdf"
- local enterd = ""
- function creGUI()
- term.setBackgroundColor(colors.blue)
- term.clear()
- term.setCursorPos(4, 7)
- term.write("enter password")
- for i=0,#password do
- term.setCursorPos(i*4, 9)
- if i<=#enterd then
- term.write("*")
- else
- term.write("_")
- end
- end
- end
- while 1 do
- creGUI()
- local event = {os.pullEventRaw()}
- if event[1]=="key" then
- enterd = enterd..keys.getName(event[2])
- end
- if password==enterd then
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1, 1)
- sleep(0.5)
- break
- end
- if #password <= #enterd then
- enterd = ""
- end
- end
Add Comment
Please, Sign In to add comment