# HG changeset patch # User Kim Alvefur # Date 1621263071 -7200 # Node ID c3896c714a8339627a350dda18769e0eec221ded # Parent 08dab7df152bdde328bb63daf7f29c9890d94eb3 tools/cfgdump: Serialize individual (table) settings in stable order too diff -r 08dab7df152b -r c3896c714a83 tools/cfgdump.lua --- a/tools/cfgdump.lua Mon May 17 16:33:44 2021 +0200 +++ b/tools/cfgdump.lua Mon May 17 16:51:11 2021 +0200 @@ -5,8 +5,15 @@ local s_format, print = string.format, print; local printf = function(fmt, ...) return print(s_format(fmt, ...)); end local it = require "util.iterators"; -local serialization = require"util.serialization"; -local serialize = serialization.new and serialization.new({ unquoted = true }) or serialization.serialize; +local function sort_anything(a, b) + local typeof_a, typeof_b = type(a), type(b); + if typeof_a ~= typeof_b then return typeof_a < typeof_b end + return a < b -- should work for everything in a config file +end +local serialization = require "util.serialization"; +local serialize = serialization.new and serialization.new({ + unquoted = true, table_iterator = function(t) return it.sorted_pairs(t, sort_anything); end, +}) or serialization.serialize; local configmanager = require"core.configmanager"; local startup = require "util.startup";