Name
ReadTable -- read table from file (V4.0)
Synopsis
table = ReadTable(id[, t])
Function
This function reads a Hollywood table from the file specified by id and returns it. Reading starts from the current file cursor position which you can modify using the Seek() command.

Starting with Hollywood 9.0, the data will be deserialized using the deserializer that can be specified in the Adapter tag in the optional table argument. Before version 9.0, ReadTable() always used Hollywood's legacy deserializer which uses a proprietary, non-human-readable format.

The following tags are currently recognized in the optional table argument:

Adapter:
This table tag can be used to specify the deserializer that should be used to import the data into a Hollywood table. This can be the name of an external deserializer plugin (e.g. xml) or it can be one of the following inbuilt deserializers:

Default:
Use Hollywood's default deserializer. This will deserialize data from the JSON format to a Hollywood table. Note that even though the name of this deserializer claims to be the default one, it is actually not. For compatibility reasons, ReadTable() will use the Inbuilt deserializer by default (see below). If you want ReadTable() to use the JSON deserializer, you explicitly have to request it by setting Adapter to Default.

Inbuilt:
Use Hollywood's legacy deserializer. The only data this deserializer will accept is data written by Hollywood's legacy serializer during the WriteTable() call. Note that for compatibility reasons, this is still the default deserializer. However, it is not recommended any longer as the data is in a proprietary, non-human-readable format. Using JSON is a much better choice.

If the Adapter tag isn't specified, it defaults to the default set using SetDefaultAdapter(). Note that for compatibility reasons, this default isn't Default but Inbuilt. See above for an explanation.

UserTags:
This tag can be used to specify additional data that should be passed to serializer plugins. If you use this tag, you must set it to a table of key-value pairs that contain the additional data that should be passed to plugins. See User tags for details. (V10.0)

Mode:
This tag can be used to set the serialization mode to use for the operation. It defaults to the serialization mode set using SetSerializeMode(). See SetSerializeMode for details. (V10.0)

Options:
This tag can be used to set the serialization options to use for the operation. It defaults to the serialization options set using SetSerializeOptions(). See SetSerializeOptions for details. (V10.0)

SrcEncoding:
This tag can be used to specify the source character encoding. This defaults to the string library's default character encoding as set by SetDefaultEncoding(). See SetDefaultEncoding for details. (V10.0)

DstEncoding:
This tag can be used to specify the destination character encoding. This defaults to the string library's default character encoding as set by SetDefaultEncoding(). See SetDefaultEncoding for details. (V10.0)

Inputs
id
file to read from
t
optional: table containing further options (V9.0)
Results
table
the table read from the file
Example
See WriteTable


Show TOC