They are three types of reading methods:
[number] readTYPE()
[TYPEStorage] readTYPE(n)
[number] readTYPE(TYPEStorage)
where TYPE can be either Char, Short, Int, Long, Float or Double.
A convenience method also exist for boolean types: [boolean] readBool(). It reads
a value on the file with readInt() and returns true if and only if this value is 1. It is not possible
to read 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 no parameter is given, one element is returned. This element is
converted to a Lua number when reading.
If n is given, n values of the specified type are read
and returned in a new Storage of that particular type.
The storage size corresponds to the number of elements actually read.
If a Storage is given, the method will attempt to read a number of elements
equals to the size of the given storage, and fill up the storage with these elements.
The number of elements actually read is returned.
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().