From bdadc69e1a9c86b65ddbbb8b53e36e06ded9fad3 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 27 Oct 2018 12:38:47 +0200 Subject: util.serialization: Separate errors for multiple table references and max depth --- util/serialization.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/util/serialization.lua b/util/serialization.lua index 401bf6f8..998b16de 100644 --- a/util/serialization.lua +++ b/util/serialization.lua @@ -128,8 +128,11 @@ 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 > 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 -- cgit v1.2.3