chore: retry with old implementation of difference

This commit is contained in:
Guillaume ARM 2024-05-20 20:21:09 +02:00
parent a8788ca3b1
commit b1c3eac1b9

View File

@ -39,16 +39,16 @@ local function sizeof(t)
return size
end
local function difference(a, b)
local ai = {}
local r = {}
for k,v in pairs(a) do r[k] = v; ai[v]=true end
for k,v in pairs(b) do
if ai[v]~=nil then r[k] = nil end
function difference(a, b)
local aa = {}
for k,v in pairs(a) do aa[v]=true end
for k,v in pairs(b) do aa[v]=nil end
local ret = {}
local n = 0
for k,v in pairs(a) do
if aa[v] then n=n+1 ret[n]=v end
end
return r
return ret
end
local function shallowClone(t)