added support for hiding of input to readline.lua

This commit is contained in:
Izaya 2017-06-19 13:18:54 +00:00
parent da6bfa2370
commit 0475903e9c

View File

@ -1,4 +1,4 @@
function readln() function readln(rC)
local s,si="",E().sI or 1 local s,si="",E().sI or 1
write("|") write("|")
while true do while true do
@ -10,7 +10,7 @@ function readln()
elseif ev[3] == 8 then elseif ev[3] == 8 then
if s:len()>0 then s=s:sub(1,-2) write("\127\127|") end if s:len()>0 then s=s:sub(1,-2) write("\127\127|") end
elseif ev[3] > 31 and ev[3] < 127 then elseif ev[3] > 31 and ev[3] < 127 then
s=s..string.char(ev[3]) write("\127"..string.char(ev[3]).."|") s=s..string.char(ev[3]) write("\127"..(rC or string.char(ev[3])).."|")
end end
end end
C.yield() C.yield()