I would like to order mapping keys in the dump for human readability.
For my use case a flat list is enough.
How about something like this?
yaml.dump(data, { mapping_key_order = { "key1", "key2", ... } }) -- keys not in the list are dumped in the end
and, for finer control:
yaml.dump(data, { mapping_key_order = function(mapping) -- This may be the default if mapping_key_order = true
local keys = tkeys(mapping)
table.sort(keys)
return keys
end }) -- keys not in the list are dumped in the end
If mapping_key_order is not specified, use the current implementation for performance.
I would like to order mapping keys in the dump for human readability.
For my use case a flat list is enough.
How about something like this?
and, for finer control:
If
mapping_key_order
is not specified, use the current implementation for performance.