Opens a file
Opens a file and returns a file handle for working with it.
r - read mode
w - write mode (overwrites existing)
a - append mode (appends to existing)
b - binary mode
r+ - update mode (existing data preserved)
w+ - update mode (existing data erased)
a+ - append update mode (existing data preserved, append at end of file only)
If the file cannot be opened this function does not raise an error (unlike io.input and io.output) but returns 3 things:
An error message (string)
An error code (number)
Thus a sensible thing to do is wrap the io.open call with an assert, as in the example:
See Also ...
f:close - Closes a file
Lua base functions
(Help topic: lua=io.open)
Enter a search string to find matching documentation.
Gammon Software support
Forum RSS feed ( https://gammon.com.au/rss/forum.xml )