Fix recursive tracking

This commit is contained in:
Gabriel Tofvesson 2024-10-14 13:03:44 +02:00
parent 053b59cf00
commit 9185d1dad4

View File

@ -106,11 +106,11 @@ end
local function cloneNonRecursive(value, sentinels)
if type(value) == "table" then
local sentinel = RecursionSentinel.getSentinel(sentinels, value)
if RecursionSentinel.isKnown(sentinels, value) then
return sentinel
return RecursionSentinel.getSentinel(sentinels, value)
end
local sentinel = RecursionSentinel.getSentinel(sentinels, value)
local clone = {}
for i,v in ipairs(value) do
clone[i] = cloneNonRecursive(v, sentinels)