mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-08-03 02:56:53 -04:00
2
API Serialization
Vexatos edited this page 2014-07-13 05:27:58 -07:00
For those that don't like images: the wiki has moved to a new place, http://ocdoc.cil.li/.
This wiki will no longer be updated.
This module provides simple value serialization.
serialization.serialize(value: any except functions[, pretty:boolean]): string
Generates a string from an object that can be parsed again usingserialization.unserialize
. The generated output is Lua code. Supports basic types (nil, boolean, number, string) and tables without cycles (will error out when cycles are detected, unless inpretty
print mode). Properly handles NaN values and infinity.
Thepretty
mode can be used to generate output for display to the user, this output will in most circumstances not be readable withserialization.unserialize
. This function can be useful for sending messages via a network card.serialization.unserialize(value: string): any
Restores an object previously saved withserialization.serialize
.