Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 760 Bytes

README.md

File metadata and controls

26 lines (17 loc) · 760 Bytes

Serializer

The "serializer" class has three core static functions for serializing any serializable object in Squirrel.

  • serialize - Pass in any object (string, integer, float, bool, null, array, table, blob) and returns a blob
  • deserialize - Pass in a blob (from serialize) and returns the original object
  • CRC - a general purpose 8-bit CRC generator for strings and blobs.

Contributors

  • Aron

Usage

The functions are all static so there is no need to instantiate the class. Simply call like so:

local obj = { "Hello": "world", "count": 123 };
local bl = serializer.serialize(obj);
// bl now contains the serialized object.
local obj2 = serializer.deserialize(bl);
// obj2 === obj