aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-27 12:17:35 +0200
committerKim Alvefur <zash@zash.se>2018-10-27 12:17:35 +0200
commit62f55ec7692181d8b01f7092047bebbfeaa9c9fe (patch)
tree7dfee8663c275078545155ddabdaab065c300b81
parent0575d4baaae6e13c9a6f614ca5da6f6192db167b (diff)
downloadprosody-62f55ec7692181d8b01f7092047bebbfeaa9c9fe.tar.gz
prosody-62f55ec7692181d8b01f7092047bebbfeaa9c9fe.zip
util.serialization: Make maximum table depth configurable
-rw-r--r--util/serialization.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/serialization.lua b/util/serialization.lua
index 64497382..401bf6f8 100644
--- a/util/serialization.lua
+++ b/util/serialization.lua
@@ -119,6 +119,7 @@ local function new(opt)
local unquoted = opt.unquoted == nil and "^[%a_][%w_]*$" or opt.unquoted;
local hex = opt.hex;
local freeze = opt.freeze;
+ local maxdepth = opt.maxdepth or 127;
-- serialize one table, recursively
-- t - table being serialized
@@ -127,7 +128,7 @@ local function new(opt)
-- l - position in o of where to insert next token
-- d - depth, used for indentation
local function serialize_table(t, o, l, d)
- if o[t] or d > 127 then
+ if o[t] or d > maxdepth then
o[l], l = fallback(t, "recursion"), l + 1;
return l;
end