Fix repeat-print of indexed values

This commit is contained in:
Gabriel Tofvesson 2024-11-28 01:43:25 +01:00
parent cd73609a2e
commit 226190b1f2

View File

@ -178,7 +178,12 @@ local function _simpleStringify(inValue, builder, ignoreGlobals, skipFunctions,
_simpleStringify(v, builder, ignoreGlobals, skipFunctions, isDeep)
end
first = #value == 0
local len = #value
for k,v in pairs(value) do
-- Array elements already printed
if type(k) == "number" and k <= len then
goto continue
end
if not first then
table.insert(builder, ",")
else
@ -188,6 +193,7 @@ local function _simpleStringify(inValue, builder, ignoreGlobals, skipFunctions,
_simpleStringify(k, builder, ignoreGlobals, skipFunctions, isDeep or type(k) == "string")
table.insert(builder, "=")
_simpleStringify(v, builder, ignoreGlobals, skipFunctions, isDeep)
::continue::
end
table.insert(builder, "}")
end