OC-MultICE/modules/drivers/keyboard.lua

20 lines
410 B
Lua
Raw Normal View History

2017-04-19 02:40:25 +10:00
function readln()
local s=""
h("display","|")
while true do
if ev[1] == "key_down" then
if ev[3] == 13 then
2017-04-19 03:42:25 +10:00
h("display","\127\n")
C.yield()
return s
2017-04-19 02:40:25 +10:00
elseif ev[3] == 8 then
if s:len()>0 then s=s:sub(1,-2) h("display","\127\127|") end
elseif ev[3] > 31 and ev[3] < 127 then
s=s..string.char(ev[3]) h("display","\127"..string.char(ev[3]).."|")
end
end
C.yield()
end
end