They are two types of reading methods:

  1. [number] writeTYPE(number)
  2. [number] writeTYPE(TYPEStorage)

where TYPE can be either Char, Short, Int, Long, Float or Double.

A convenience method also exist for boolean types: writeBool(value). If value is nil or not true a it is equivalent to a writeInt(0) call, else to writeInt(1). It is not possible to write storages of booleans.

All these methods depends on the encoding choice: ASCII or binary mode. In ASCII mode, the option autoSpacing() and noAutoSpacing() have also an effect on these methods.

If one Lua number is given, this number is converted according to the name of the method when writing (e.g. writeInt(3.14) will write 3).

If a Storage is given, the method will attempt to write all the elements contained in the storage.

Thes methods return the number of elements actually written.

In case of read error, these methods will call the Lua error function using the default pedantic option, or stay quiet with the quiet option. In the latter case, one can check if an error occurred with hasError().