1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-11-22 20:10:34 -05:00
OC-PsychOS2/module/newio.lua

35 lines
525 B
Lua
Raw Normal View History

2019-11-03 16:54:30 -05:00
io = {}
function io.input(fd)
if type(fd) == "string" then
fd=fs.open(fd,"rb")
end
if fd then
os.setenv("STDIN",fd)
end
return os.getenv("STDIN")
end
function io.output(fd)
if type(fd) == "string" then
fd=fs.open(fd,"wb")
end
if fd then
os.setenv("STDOUT",fd)
end
return os.getenv("STDOUT")
end
io.open = fs.open
function io.read(...)
return io.input():read()
end
function io.write(...)
io.output():write(...)
end
function print(...)
for k,v in ipairs({...}) do
io.write(tostring(v).."\n")
end
end