Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local s = ""
- os.startTimer(2)
- local function command(com)
- print("'"..com.."'")
- if(com == ":quit") then
- error()
- end
- end
- local function clearInput()
- s = ""
- term.setCursorPos(1,5)
- term.clearLine()
- term.write(">")
- end
- term.clear()
- term.setCursorBlink(true)
- clearInput()
- while true do
- event, param1, param2, param3 = os.pullEvent()
- if(event == "char") then
- s = s .. param1
- term.write(param1)
- elseif(event == "key") then
- if(param1 == keys.enter) then
- clearInput()
- command(s)
- end
- elseif(event == "timer") then
- os.startTimer(2)
- else
- print(event .. ":" .. param1 .. "," .. param2 .. "," ..param3)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment