aboutsummaryrefslogtreecommitdiffstats
path: root/util
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
commit97c56e6c7184b6a90f36ecffa6db00ac57772673 (patch)
tree7dfee8663c275078545155ddabdaab065c300b81 /util
parentd833e2c6d4651de786a12fc9df6d7450e59d3d33 (diff)
downloadprosody-97c56e6c7184b6a90f36ecffa6db00ac57772673.tar.gz
prosody-97c56e6c7184b6a90f36ecffa6db00ac57772673.zip
util.serialization: Make maximum table depth configurable
Diffstat (limited to 'util')
-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