1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-11-25 12:42:10 -05:00
OC-PsychOS2/module/newio.lua
2019-11-04 08:54:30 +11:00

35 lines
525 B
Lua

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