From b1c3eac1b944d665bfc0444c605587537278a6c4 Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Mon, 20 May 2024 20:21:09 +0200 Subject: [PATCH] chore: retry with old implementation of difference --- inferium-harvester.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/inferium-harvester.lua b/inferium-harvester.lua index c411e7d..dc9f330 100644 --- a/inferium-harvester.lua +++ b/inferium-harvester.lua @@ -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)