lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Yes, yet another serializer and pretty printer. I carefully studied
existing implementations and described my rationale and examples here:
http://notebook.kulchenko.com/programming/serpent-lua-serializer-pretty-printer.

My requirements for a serializer: (1) pure Lua (need to execute it as
part of a debugger on various platforms including mobile), (2) does
both pretty printing and robust serialization, (3) handles shared and
self-references, (4) serializes keys of various types, including
tables as keys, and (5) is short and doesn't have too many
dependencies to be included with another module.

To summarize, I want the serialized result that is as readable as
possible and is still a valid fragment that I can load with
loadstring. The implementation is fairly short and sufficiently fast
for my needs, but I'm sure it can be improved on both of those counts.

"Serpent" because it handles self-references and reminds me of a
serpent eating its own tail (http://en.wikipedia.org/wiki/Ouroboros).
Available on github.

Paul.