read

LUA

read

read ([FILEHANDLE,] [FORMAT1,…])

Reads flle _INPUT (or filehandle, if given) ac formats. For each format, a string (or a number) is characters read, or nil if it cannot read data with th The available formats are:

  • *n
  • reads a number, and returns a number **
  • *l
  • reads the next line (skipping the end of line), or nil on EOF (default behaviour)
  • *a
  • reads the whole flle, starting at the current position.On EOF, it returns an empty string
  • *w
  • reads the next word (maximal sequence of non-whitespace characters), skipping spaces if necessary, or nil on EOF.
  • number
  • reads a string with up to that number of characters, or nil on EOF