Closed ichaozai closed 3 years ago
If there are no contents inside, does it matter? Perhaps you can already tell by the name of the key or some other clue from the document structure if you have specific documents.
Otherwise, If you really need to do this for generality or roundtripping or similar, then you’ll need to tweak the dumper code to write a sentinel value for one or the other or both - much the way that it already handles nil.
The best place to start is with a copy of dumper_mt
in lib/lyaml/init.lua and then tweak accordingly.
output:
Lua uses table as array. How to distinguish an empty table and an empty array?