Lua io functions
Lua io functions These are the functions in the "io" table. Implicit operations (eg. io.read, io.write) use the standard file descriptors io.stdin, io.stdout, and io.stderr. You can operate on other files by getting a "file descriptor" from io.open, io.input, or io.output, and using that. Note the syntactical difference, that you follow a file descriptor by a colon, eg. f:close () Also see the description for the "os" table for operating system functions that do things like remove and rename files. The operations whose name start with "f:" (such as f:read) depend on having an open file handle returned from io.open, io.input, or io.output. Note the colon after the f, as this indicates that the file handle (userdata from the open) is to be supplied as the first argument to the function. See Also ... Topics Lua base functions Lua bc (big number) functions Lua bit manipulation functions Lua coroutine functions Lua debug functions Lua math functions Lua os functions Lua package functions Lua PCRE regular expression functions Lua script extensions Lua string functions Lua table functions Lua utilities Scripting Lua functions f:close (Closes a file) f:flush (Flushes outstanding data to disk) f:lines (Returns an iterator function for reading the file line-by-line) f:read (Reads the file according to the specified formats) f:seek (Sets and gets the current file position) f:setvbuf (Sets the buffering mode for an output file) f:write (Writes to a file) io.close (Closes a file) io.flush (Flushes outstanding data to disk for the default output file) io.input (Opens filename for input in text mode) io.lines (Returns an iterator function for reading a named file line-by-line) io.open (Opens a file) io.output (Opens a file for output) io.popen (Creates a pipe and executes a command) io.read (Reads from the default input file) io.stderr (File handle for standard error file) io.stdin (File handle for standard input file) io.stdout (File handle for standard output file) io.tmpfile (Returns a handle to a temporary file) io.type (Returns type of file handle) io.write (Writes to the default output file) (Help topic: general=lua_io) Documentation contents page