This is an abstract class. It defines most methods implemented by its child classes, like DiskFile, MemoryFile and PipeFile.

Methods defined here are intended for basic read/write functionalities. Read/write methods might write in ASCII mode or binary mode.

In ASCII mode, numbers are converted in human readable format (characters). Booleans are converted into 0 (false) or 1 (true). In binary mode, numbers and boolean are directly encoded as represented in a register of the computer. While not being human readable and less portable, the binary mode is obviously faster.

In ASCII mode, if the default option autoSpacing() is chosen, a space will be generated after each written number or boolean. A carriage return will also be added after each call to a write method. With this option, the spaces are supposed to exist while reading. This option can be deactivated with noAutoSpacing().

A Lua error might or might be not generated in case of read/write error or problem in the file. This depends on the choice made between quiet() and pedantic() options. It is possible to query if an error occured in the last operation by calling hasError().

Subsections

  1. Read methods
  2. Write methods
  3. Lua style read/write methods
  4. Serialization methods
  5. ascii() [default]
  6. autoSpacing() [default]
  7. binary()
  8. clearError()
  9. close()
  10. [boolean] hasError()
  11. [boolean] isQuiet()
  12. [boolean] isReadable()
  13. [boolean] isWritable()
  14. noAutoSpacing()
  15. synchronize()
  16. pedantic() [default]
  17. [number] position()
  18. quiet()
  19. seek(position)
  20. seekEnd()