- ddr special logic seems to be working in solation
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
mr.one
2026-03-21 17:26:39 +01:00
parent c41bf23a45
commit 9a3c9ee28c
7 changed files with 154 additions and 26 deletions

View File

@@ -39,4 +39,31 @@ function Util.contains(t, value)
end
end
return false
end
end
--- Deep copies tables
--- @within Util
--- @param orig any The value to deep copy.
--- @param seen any Used for recursive calls to handle loops
--- @return any any The copied object
function Util.deepcopy(orig, seen)
if type(orig) ~= "table" then
return orig
end
if seen and seen[orig] then
return seen[orig] -- handle cycles / shared refs
end
local copy = {}
seen = seen or {}
seen[orig] = copy
for k, v in pairs(orig) do
local new_k = Util.deepcopy(k, seen)
local new_v = Util.deepcopy(v, seen)
copy[new_k] = new_v
end
return setmetatable(copy, getmetatable(orig))
end