2017-06-19 23:18:54 +10:00
|
|
|
function readln(rC)
|
2017-05-24 01:14:50 +10:00
|
|
|
local s,si="",E().sI or 1
|
2017-05-16 02:26:28 +10:00
|
|
|
while true do
|
2017-05-24 01:14:50 +10:00
|
|
|
if ev[1] == "key" and ev[2] == si then
|
2017-05-16 02:26:28 +10:00
|
|
|
if ev[3] == 13 then
|
2017-07-15 03:10:47 +10:00
|
|
|
write("\n")
|
2017-05-16 02:26:28 +10:00
|
|
|
C.yield()
|
|
|
|
return s
|
|
|
|
elseif ev[3] == 8 then
|
2017-07-15 02:32:47 +10:00
|
|
|
if s:len()>0 then s=s:sub(1,-2) write("\127") end
|
2017-05-16 02:26:28 +10:00
|
|
|
elseif ev[3] > 31 and ev[3] < 127 then
|
2017-07-15 02:32:47 +10:00
|
|
|
s=s..string.char(ev[3]) write((rC or string.char(ev[3])))
|
2017-05-16 02:26:28 +10:00
|
|
|
end
|
|
|
|
end
|
|
|
|
C.yield()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|