From 29ed334369e232f3c05680a4640becc31cfb0837 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Wed, 12 May 2021 20:45:15 +0200 Subject: [PATCH] Persistence: Fix Lua log file table dump --- persistence.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/persistence.lua b/persistence.lua index 929936f..d7db0e9 100644 --- a/persistence.lua +++ b/persistence.lua @@ -103,8 +103,9 @@ function lua_log_file:_dump(value, is_key) for _, value in ipairs(value) do table.insert(entries, self:_dump(value)) end + local tablelen = #value for key, value in pairs(value) do - if type(key) ~= "number" or key % 1 ~= 0 or key < 1 or key > #value then + if type(key) ~= "number" or key % 1 ~= 0 or key < 1 or key > tablelen then local dumped, short = self:_dump(key, true) table.insert(entries, (short and dumped or ("[" .. dumped .. "]")) .. "=" .. self:_dump(value)) end