forked from izaya/OC-PsychOS2
made io create a default sink fd
This commit is contained in:
parent
95e6a18216
commit
517d579bb9
@ -3,7 +3,7 @@ _G.fd,_G.io = {},{}
|
|||||||
function io.write(d) -- writes *d* to stdout
|
function io.write(d) -- writes *d* to stdout
|
||||||
fd[os.getenv("t") or 1].write(d)
|
fd[os.getenv("t") or 1].write(d)
|
||||||
end
|
end
|
||||||
function io.read(d,b) -- reads *d* from stdin, until something is returned, or the thing returned equals *b*
|
function io.read(d,b) -- reads *d* from stdin, until something is returned, or b is true
|
||||||
local r = ""
|
local r = ""
|
||||||
repeat
|
repeat
|
||||||
r=fd[os.getenv("t") or 1].read(d)
|
r=fd[os.getenv("t") or 1].read(d)
|
||||||
@ -63,3 +63,12 @@ function io.open(f,m) -- opens file *f* with mode *m*
|
|||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
do
|
||||||
|
local fdi,nfd = io.newfd()
|
||||||
|
function nfd.read()
|
||||||
|
end
|
||||||
|
function nfd.write()
|
||||||
|
end
|
||||||
|
function nfd.close()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user