Tamed Pluto
by Stefan Reich, Nov 1st 2012
Pluto is the serialization library used by Mobile Lua (and many other Lua projects).
Pluto is very powerful, but so far, it was very hard to debug (and it is kinda crash-happy when anything is not the way it expects...). Also, Pluto's image format is not architecture-independent. For example, Pluto images generated on 32-bit machines can not be read by 64-bit machines.
Tamed Pluto aims to tackle both of these shortcomings.
Tamed Pluto is a drop-in replacement for Pluto 2.4. It should work in any code that has been tested against Pluto 2.4.
Tamed Pluto offers two new functions:
- pluto.version() - returns Tamed Pluto's version info as a string.
- pluto.human(true/false) - toggles human-readable output. If the flag is true, pluto.persist returns a human-readable string instead of the binary image.
The "human-readable" image format is designed to account for every single byte written and allow you to see what it represents:
require 'pluto'
print("Pluto version: "..pluto.version())
pluto.human(true)
a = pluto.persist({}, "bla")
print("Image:\n"..a)
=>
Pluto version: Tamed Pluto 1.0
Image:
pi_write 4 01000000
persist_newobject
pi_write 4 01000000
persist_counter 1
pi_write 4 04000000
persist string
persiststring
pi_write 4 03000000
write_size 3
pi_write 3 626C61
persiststring 3 "bla"
pi_write is the raw byte writer; the lines directly below it (without indent) specify what those bytes mean.
Binaries
- pluto.dll (Win32)
- pluto.so.debian32 (Debian, 32 bit Intel - rename to pluto.so)
- pluto.so.debian64 (Debian, 64 bit Intel - rename to pluto.so)
Source code
Use Pluto 2.4 as a basis. Replace pluto.c with the tamed version. Build as always.
History
- Done (Oct 29 2012): Release Tamed Pluto 1.0

