Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local keyUp = true
- cursorPos = {x = 1, y = 2}
- enter = false
- function reader(currentString)
- local t2, key = os.pullEvent()
- if t2 == "key_up" then keyUp = true end
- if keyUp == true then
- if t2 == "char" then
- keyUp = false
- return currentString .. key
- end
- if key == 259 and t2 == "key" then
- keyUp = false
- return string.sub(currentString, 1, #currentString-1)
- end
- if key == 257 and t2 == "key" then
- history = 0
- enter = true
- end
- end
- return currentString
- end
- --[[local myString = ""
- local lastString = ""
- while true do
- myString = reader(myString)
- if(myString ~= lastString) then
- term.clear()
- term.setCursorPos(1,1)
- print(myString)
- lastString = myString
- end
- end--]]
- return reader
Advertisement
Add Comment
Please, Sign In to add comment