BTW, I remember that Fabien wanted to serialize such stuff for Metalua.
I do need a comprehensive serializer, but bootstrapping the compiler in pure Lua is already quite a hassle, so I'm reluctant about introducing C dependencies unless I really need them. I already withdrew a dependency to Pluto for this reason. As it happens, the current pure-Lua solution
handles everything I need (cycles, shared subtrees, functions) in less than 100 LoC, while being fast enough, even on my pretty old hardware. The fact that serialized data happens to be some standard, human-readable Lua source code could also be interesting in some cases.
Given the many serializers that exist in Lua, if a de facto standard API emerged, I'd make my module respect them, so that people who need more speed could easily switch for a native one.
However, in Metalua's case, the main concern is to make sure that the compilation of one file won't interfere with the compilation of the next ones. If I were to introduce some native dependencies, this would be better done through POSIX's fork() and copy-on-write mechanisms.