From: Vladimír Čunát Date: Wed, 10 Apr 2019 11:44:59 +0000 (+0200) Subject: fixup! sandbox: table_print sorts table keys X-Git-Tag: v4.0.0~11^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ff5ae1e7afbdd7938011cb9436621dfaf7ce1d4;p=thirdparty%2Fknot-resolver.git fixup! sandbox: table_print sorts table keys --- diff --git a/daemon/lua/sandbox.lua.in b/daemon/lua/sandbox.lua.in index 14ada7f64..33da8ca96 100644 --- a/daemon/lua/sandbox.lua.in +++ b/daemon/lua/sandbox.lua.in @@ -396,13 +396,13 @@ function table_print (tt, indent, done) done = done or {} indent = indent or 0 local result = "" - -- Convert to printable string (escape unprintable) + -- Ordered for-iterator for tables with tostring-able keys. local function ordered_iter(unordered_tt) local keys = {} for k in pairs(unordered_tt) do - table.insert(keys, tostring(k)) + table.insert(keys, k) end - table.sort(keys) + table.sort(keys, function (a, b) return tostring(a) < tostring(b) end) local i = 0 return function() i = i + 1 @@ -411,6 +411,7 @@ function table_print (tt, indent, done) end end end + -- Convert to printable string (escape unprintable) local function printable(value) value = tostring(value) local bytes = {}