debug.upvaluejoin()

debug.upvaluejoin (f1, n1, f2, n2) Make the n1-th upvalue of the Lua closure f1 refer to the n2-th upvalue of the Lua closure f2.

dofile()

dofile ([filename])dofilestdindofiledofile

error()

error (message [, level])messageerror Usually, error adds some information about the error position at the beginning of the message, if the message is a string. The level argument specifies how to get the error position. With level 1 (the default), the error position is where the error function was called. Level 2 points the error to where the function that called error was called; and so on. Passing a level 0 avoids the addition of error position information to the message.

file:close()

file:close () Closes file. Note that files are automatically closed when their handles are garbage collected, but that takes an unpredictable amount of time to happen. When closing a file handle created with io.popen, file:close returns the same values returned by os.execute.

file:flush()

file:flush () Saves any written data to file.

file:lines()

file:lines (···) Returns an iterator function that, each time it is called, reads the file according to the given formats. When no format is given, uses "l" as a default. As an example, the construction for c in file:lines(1) do body end will iterate over all characters of the file, starting at the current position. Unlike io.lines, this function does not close the file when the loop ends. In case of errors this function raises the error, instead of returning an error code.

file:read()

file:read (···) Reads the file file, according to the given formats, which specify what to read. For each format, the function returns a string or a number with the characters read, or nil if it cannot read data with the specified format. (In this latter case, the function does not read subsequent formats.) When called without formats, it uses a default format that reads the next line (see below). The available formats are "n": reads a numeral and returns it as a float or an integer, fol

file:seek()

file:seek ([whence [, offset]]) Sets and gets the file position, measured from the beginning of the file, to the position given by offset plus a base specified by the string whence, as follows: "set": base is position 0 (beginning of the file); "cur": base is current position; "end": base is end of file; In case of success, seek returns the final file position, measured in bytes from the beginning of the file. If seek fails, it returns nil, plus a string describing the error. The

file:setvbuf()

file:setvbuf (mode [, size]) Sets the buffering mode for an output file. There are three available modes: "no": no buffering; the result of any output operation appears immediately. "full": full buffering; output operation is performed only when the buffer is full or when you explicitly flush the file (see io.flush). "line": line buffering; output is buffered until a newline is output or there is any input from some special files (such as a terminal device). For the last two case

file:write()

file:write (···) Writes the value of each of its arguments to file. The arguments must be strings or numbers. In case of success, this function returns file. Otherwise it returns nil plus a string describing the error.