lua-users home
lua-l archive

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


On 14/01/2015 12:51, Timm S. Mueller wrote:
Hi,

before I'm starting to write my own, I'm looking for a serialization
and deserialization library. Requirements:

- must cover Lua 5.1, 5.2, 5.3 and LuaJIT
- in the MIT/BSD/CC/PD license department
- must cover cyclic references and binary data
- preferrably written in C for performance, Lua would be fine also
- should only use official Lua APIs, no outside dependencies, no state
internals
- The transport format should be legal Lua, but this isn't strictly a
requirement and may be sacrificed if the result can be transported,
preferrably also between different architectures and Lua versions. I'm
not objecting to using JSON format either.

Not required: Userdata, metatables, functions and upvalues. A small
footprint and the ability to operate on a writer/readers would be nice.
Any ideas, recommendations?


After a lot of hassle I settled on Lua Marshal which might be a starting point.

Plain C.
MIT
No table size limit unlike almost all Lua high level based.
No funny code I've found: many of the mentioned solutions I found didn't actually work.

5.3? No idea.
Portable? No, is marked as such, why is unclear. If this is binary endian you have the source, fix it. Lua version, not so simple.

This handles > 100MB serialised on disk tables. Actually used for backup storage, yes a daft thing to do but reality is this is how it ended up and works for what I am doing.

https://github.com/richardhundt/lua-marshal