function readln(rC) local s,si="",os.getenv("sI") while true do _,sI,c,C = event.pull("key") if sI == si then if c == 13 then write(" \n") coroutine.yield() return s elseif c == 8 then if s:len()>0 then s=s:sub(1,-2) write("\127") end elseif c > 31 and c < 127 then s=s..string.char(c) write((rC or string.char(c))) end end end end io.read = readln