# HG changeset patch # User Kim Alvefur # Date 1540636727 -7200 # Node ID 9a1e2f5f674f99b7636834fbe0675a46a40b8ec3 # Parent ed0090f8b709f6464f71f2c711ae8f58799bc625 util.serialization: Separate errors for multiple table references and max depth diff -r ed0090f8b709 -r 9a1e2f5f674f util/serialization.lua --- 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