On 2026-08-30 21:29, 'Martin Eden' via lua-l wrote:
> Hello list,
>
> I've updated my Lua table serializer. It serializes any Lua table
> to load()-able Lua code.
>
> There are not much of visible changes. I reviewed and updated most of
> it's implementation. I wanted it be logical and simple to follow and
> maintain. [...]
>
>
https://github.com/martin-eden/lua_table_serializer/blob/master/deploy/serialize_lua_graph.lua
>
G'day Martin,
Lua 5.3 onwards supports the UTF-8 escape sequence '\u{XXX}' when
parsing source. Sometime ago, I suggested adding a '%Q' format
specifier to string.format, which is identical to "%q", except that
it looks for valid UTF-8 sequences, and, if found, emits the '\u{XX}'
equivalent. This '%Q' proposal hasn't been adopted by the Lua
language/libraries/ecosystem.
However, if interested, you might wish to add a flag to your
serializer, requesting this behaviour.
- The upside is that the output is more likely to be ASCII-based,
and therefore easily editable;
- One downside is that there would need to be extra work, with
an impact on efficiency, when serialising strings; and
- Another downside is that the serialised table is not compatible
with Lua 5.1 or 5.2; I have not investigated compatibility
relating to other Lua implementations (e.g. LuaJIT).
cheers, s-b etc.