This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Deathura's profile picture

[LUA][QUESTION]How to set path for new file created by program?

Started by Deathura, 15 March 2012 - 06:28 PM
Deathura #1
Posted 15 March 2012 - 07:28 PM
So I got realized that io.open will create file if it doesn't exist. But how I can choose the path/directory for the file?
MysticT #2
Posted 15 March 2012 - 07:34 PM
Just add it to the path you pass to the function:

io.open("path/filename", "mode")
"path" is the path/directory where the file will be, "filename" the name of the file inside the directory, and "mode" the open mode (r, w, a, rb, wb, ab).