util.serialization

Often you will find yourself wanting to convert a table of data to a string. You would need to do this before saving to a file, or displaying on-screen for example.

This serialization library provides that functionality.

Many different types can be serialized, though some are not supported (some are not possible, others may just need adding). The following is a list of types:

Supported number, string, boolean, table
Not supported function

Stanza objects consist of tables and so can be serialized, but currently some extra steps are necessary.

Reference

serialize(data)

Returns a string representing the given data (usually, but not always, a table).

deserialize(string)

Returns the original data, given a string returned by serialize(data).

append(object, data)

Appends the string data to 'object', which may be any object with a 'write' method (such as a file, or socket), otherwise it is assumed to be an array and the data is inserted at the end of the array.

 
doc/developers/util/serialization.txt · Last modified: 2009/12/20 17:43 (external edit)