Software /
code /
prosody
Diff
util/serialization.lua @ 9565:9a1e2f5f674f
util.serialization: Separate errors for multiple table references and max depth
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 27 Oct 2018 12:38:47 +0200 |
parent | 9564:ed0090f8b709 |
child | 9567:dbfa286cfa88 |
line wrap: on
line diff
--- a/util/serialization.lua Sat Oct 27 12:17:35 2018 +0200 +++ b/util/serialization.lua Sat Oct 27 12:38:47 2018 +0200 @@ -128,8 +128,11 @@ -- 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 > maxdepth then - o[l], l = fallback(t, "recursion"), l + 1; + if o[t] then + o[l], l = fallback(t, "table has multiple references"), l + 1; + return l; + elseif d > maxdepth then + o[l], l = fallback(t, "max table depth reached"), l + 1; return l; end