mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-22 22:24:35 +00:00
changed pretty printing to use sorted keys
This commit is contained in:
parent
433e4ebb08
commit
1e75fad409
@ -1,14 +1,15 @@
|
|||||||
--[[
|
--[[
|
||||||
pretty formatting and printing for nested data structures
|
pretty formatting and printing for nested data structures
|
||||||
|
|
||||||
also able to be parsed by lua in many cases, but not always
|
also able to be parsed by lua in _many_ cases, but _not all cases_, be careful!
|
||||||
|
|
||||||
circular references and depth limit will cause the string to contain
|
circular references and depth limit will cause the string to contain
|
||||||
things that cannot be parsed.
|
things that cannot be parsed.
|
||||||
|
|
||||||
this isn't a full serialisation solution, it's for debugging and display to humans
|
this isn't a full serialisation solution, it's for debugging and display to humans
|
||||||
|
|
||||||
all exposed functions take a config table, defaults found in pretty.default_config
|
all exposed functions take a config table,
|
||||||
|
defaults found (and can be modified) in pretty.default_config
|
||||||
|
|
||||||
indent
|
indent
|
||||||
indentation to use for each line, or "" for single-line packed
|
indentation to use for each line, or "" for single-line packed
|
||||||
@ -117,7 +118,7 @@ function pretty._process(input, config, processing_state)
|
|||||||
table.insert(chunks, internal_value(v))
|
table.insert(chunks, internal_value(v))
|
||||||
end
|
end
|
||||||
--non sequential follows
|
--non sequential follows
|
||||||
for k, v in pairs(input) do
|
for k, v in tablex.spairs(input) do
|
||||||
if not seen[k] then
|
if not seen[k] then
|
||||||
--encapsulate anything that's not a string
|
--encapsulate anything that's not a string
|
||||||
--todo: also keywords and strings with spaces
|
--todo: also keywords and strings with spaces
|
||||||
|
Loading…
Reference in New Issue
Block a user