MightyPirates / OpenComputers

Home of the OpenComputers mod for Minecraft.
https://oc.cil.li
Other
1.59k stars 430 forks source link

cant get current io.input #3201

Closed buttercheetah closed 4 years ago

buttercheetah commented 4 years ago

according to lua.org the following should work

local temp = io.input()   -- save current file
io.input("newinput")      -- open a new current file
...                       -- do something with new input
io.input():close()        -- close current file
io.input(temp)            -- restore previous current file

sadly everytime i try to run this i get the error "expected string got table" i have tested this out in lua and io.input() returns a table. if this isnt an issue please provide an alternative

payonel commented 4 years ago

yeah ... i inherited SOME openos libraries from the old "OC 1.5 and before" days. I noticed this io.input/output check for a table and I didn't know why it was like this. I have left it there all this time. It's about time i remove it because it isn't correct and isn't adding value