textutils.unserialize

From ComputerCraft Wiki
Jump to: navigation, search


Grid Redstone.png  Function textutils.unserialize
Returns the data reassembled from string serializedData. Returns nil if unable to unserialize. Used mainly together with textutils.serialize(). Also exists as textutils.unserialise under CC 1.6 or later.


Note: the representation used by textutils.serialize() actually creates Lua-friendly syntax, so that loadstring() will also work to unserialize. See textutils.serialize() for more information.
Syntax textutils.unserialize(string serializedData)
Returns any unserializedData
Part of ComputerCraft
API textutils

Examples

Grid paper.png  Example
Unserializes a table and prints a value in it.
Code
local serializedTable = "{value=2}"
local myTable = textutils.unserialize( serializedTable )

print( myTable.value )
Output 2