My first idea was something like this:
function updateTimer()
os.startTimer(1)
os.pullEvent("timer")
--Code goes here
end
function parseInput()
local input = io.read()
--Code goes here
end
while true do parallel.waitForAny(updateTimer, parseInput) end
Problem is my updateTimer method required moving the terminal cursor- that may not be why but io.read just didn't work.
Next idea was to just capture events, and convert the keycodes I receive into a string that made up my query:
while true do local id,key = os.pullEvent() if id=="timer" then updateTimer() else if key==28 then parseInput(input) else input = input..string.char(key) end end
The issue here was the string.char() method has a wildly differing definition of keys to the os.pullEvent method.
Neither method worked but I think both should. They need to be adapted better to the development environment.
Could anyone suggest how either or both can be adapted to work better with the existing API's and Lua framework?
Thanks for reading,
Nitrogen Fingers












