Difference between revisions of "TLTools"

(Noted a potential problem)
m (Corrected instructions for new version of TSerial)
Line 1: Line 1:
 
==TSerial==
 
==TSerial==
Converts tables into strings. That way you can save tables to files, or send them across a network. Currently only supports tables with keys that are strings or numbers, and values that are strings, numbers, tables, or booleans.
+
Converts tables into strings. That way you can save tables to files, or send them across a network. Currently supports tables with keys that are strings, numbers, or booleans, and values that are strings, numbers, tables, or booleans. Functions, userdata, and circular references aren't supported.
* ''TSerialize(table)'' returns a string of the Lua code which will recreate the table.
+
* ''TSerial.pack(table)'' returns a string representation of a table. The string is, in fact, Lua code.
*To deserialize, use ''loadstring("table="..serial)()''.
+
* ''TSerial.unpack(string)'' returns a recreation of the serialized table.
  
 
==TLibCompress==
 
==TLibCompress==

Revision as of 10:13, 16 April 2011

TSerial

Converts tables into strings. That way you can save tables to files, or send them across a network. Currently supports tables with keys that are strings, numbers, or booleans, and values that are strings, numbers, tables, or booleans. Functions, userdata, and circular references aren't supported.

  • TSerial.pack(table) returns a string representation of a table. The string is, in fact, Lua code.
  • TSerial.unpack(string) returns a recreation of the serialized table.

TLibCompress

Can zip and unzip strings, reducing their size. A good way to save bandwidth when sending strings across a network. Please note: Do not write compressed strings to a file, since they can't be read correctly by Love 0.7.0 due to a file-reading bug.

  • TLibCompress.CompressLZW(string) returns a zipped string
  • TLibCompress.UncompressLZW(string) returns an unzipped version of a zipped string

Download

TLTools on Github