FANDOM



read([<FileHandle>,] <sFormat1>, ...)
Description (from LUA 4 Manual: 6.4 I/O Facilities)
"Reads file _INPUT, or <FileHandle> if this argument is given, 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. When called without formats, it uses a default format that reads the next line (see below).
The available formats are
"*n"
reads a number; this is the only format that returns a number instead of a string.
"*l"
reads the next line (skipping the end of line), or nil on end of file. This is the default format.
"*a"
reads the whole file, starting at the current position. On end of file, it returns the empty string.
"*w"
reads the next word (maximal sequence of non--white-space characters), skipping spaces if necessary, or nil on end of file.
number
reads a string with up to that number of characters, or nil on end of file."
Example


Arguments
<FileHandle>: the handle of the file to read.
<sFormat1> to <sFormatN>: strings specifying what to read.
Scope
Related Pages

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.