Ace3

API / AceSerializer-3.0

AceSerializer-3.0 can serialize any variable (except functions or userdata) into a string format, that can be send over the addon comm channel.
AceSerializer was designed to keep all data intact, especially very large numbers or floating point numbers, and table structures. The only caveat currently is, that multiple references to the same table will be send individually.

AceSerializer-3.0 can be embeded into your addon, either explicitly by calling AceSerializer:Embed(MyAddon) or by specifying it as an embeded library in your AceAddon. All functions will be available on your addon object and can be accessed directly, without having to explicitly call AceSerializer itself.
It is recommended to embed AceSerializer, otherwise you'll have to specify a custom `self` on all calls you make into AceSerializer.


AceSerializer:Deserialize(str)

Deserializes the data into its original values.
Accepts serialized data, ignoring all control characters and whitespace.

Parameters

str
The serialized data (from :Serialize)

Return value

true followed by a list of values, OR false followed by an error message


AceSerializer:Serialize(...)

Serialize the data passed into the function.
Takes a list of values (strings, numbers, booleans, nils, tables) and returns it in serialized form (a string).
May throw errors on invalid data types.

Parameters

...
List of values to serialize

Return value

The data in its serialized form (string)


You must login to post a comment. Don't have an account? Register to get one!

  • 2 comments
  • Avatar of coolflame coolflame Sep 28, 2011 at 18:52 UTC - 0 likes

    PTR 4.3 LUA Error:

    Count: 1
    Message: ...\AddOns\Ace3\AceSerializer-3.0\AceSerializer-3.0.lua line 27:
       Division by zero
    Debug:
       [C]: ?
       ...\AddOns\Ace3\AceSerializer-3.0\AceSerializer-3.0.lua:27: in main chunk
    AddOns:
      Swatter, v5.9.4960 (WhackyWallaby)
      Ace3, v
      ACP, v3.3.16 
      BlizRuntimeLib_enUS v4.3.0.40200 <public-test.logon.battle.net>
      (ck=81)
    
    Last edited Sep 28, 2011 by coolflame
  • Avatar of crazedfred crazedfred Jan 06, 2011 at 23:24 UTC - 0 likes

    As per galmok's request, I have added a comment to LibCompress about how to use LibCompress, AceSerializer, and AceComms to efficiently send arbitrary Lua data over an Addon message. You can view the comment here (just scroll down if the link doesn't quite work):

    http://www.wowace.com/addons/libcompress/#c1

    Last edited Jan 06, 2011 by crazedfred
  • 2 comments