iolib¶
close¶
Close file
or default output file.
flush¶
Saves any written data to default output file.
input¶
Sets file
as the default input file.
lines¶
...(param):
| "n" -- Reads a numeral and returns it as number.
| "a" -- Reads the whole file.
-> "l" -- Reads the next line skipping the end of line.
| "L" -- Reads the next line keeping the end of line.
open¶
function io.open(filename: string, mode?: "a"|"a+"|"a+b"|"ab"|"r"...(+7))
-> file*?
2. errmsg: string?
Opens a file, in the mode specified in the string mode
.
mode:
-> "r" -- Read mode.
| "w" -- Write mode.
| "a" -- Append mode.
| "r+" -- Update mode, all previous data is preserved.
| "w+" -- Update mode, all previous data is erased.
| "a+" -- Append update mode, previous data is preserved, writing is only allowed at the end of file.
| "rb" -- Read mode. (in binary mode.)
| "wb" -- Write mode. (in binary mode.)
| "ab" -- Append mode. (in binary mode.)
| "r+b" -- Update mode, all previous data is preserved. (in binary mode.)
| "w+b" -- Update mode, all previous data is erased. (in binary mode.)
| "a+b" -- Append update mode, previous data is preserved, writing is only allowed at the end of file. (in binary mode.)
output¶
Sets file
as the default output file.
popen¶
Starts program prog in a separated process.
mode:
| "r" -- Read data from this program by `file`.
| "w" -- Write data to this program by `file`.
read¶
Reads the file
, according to the given formats, which specify what to read.
...(param):
| "n" -- Reads a numeral and returns it as number.
| "a" -- Reads the whole file.
-> "l" -- Reads the next line skipping the end of line.
| "L" -- Reads the next line keeping the end of line.
stderr¶
standard error.
stdin¶
standard input.
stdout¶
standard output.
tmpfile¶
In case of success, returns a handle for a temporary file.
type¶
Checks whether obj
is a valid file handle.
return #1:
| "file" -- Is an open file handle.
| "closed file" -- Is a closed file handle.
| `nil` -- Is not a file handle.
write¶
Writes the value of each of its arguments to default output file.