# HG changeset patch # User Kim Alvefur # Date 1540635455 -7200 # Node ID ed0090f8b709f6464f71f2c711ae8f58799bc625 # Parent 732314eb325825500c0b6fa6b5033e8b7a1e6025 util.serialization: Make maximum table depth configurable diff -r 732314eb3258 -r ed0090f8b709 util/serialization.lua --- a/util/serialization.lua Fri Oct 26 19:53:02 2018 +0100 +++ b/util/serialization.lua Sat Oct 27 12:17:35 2018 +0200 @@ -119,6 +119,7 @@ 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 @@ -- 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