Skip to content

Instantly share code, notes, and snippets.

@SwadicalRag
Created September 10, 2015 05:36
Show Gist options
  • Select an option

  • Save SwadicalRag/096725742630b8428c49 to your computer and use it in GitHub Desktop.

Select an option

Save SwadicalRag/096725742630b8428c49 to your computer and use it in GitHub Desktop.
compare tables
local function compare(tbl1,tbl2,compared)
compared = compared or {}
for k,v in pairs(tbl1) do
if(type(v) == "table") then
if not compared[v] then
if(type(tbl2[k]) == "table") then
compared[v] = true
if not compare(v,tbl2[k],compared) then
return false
end
else
return false
end
end
else
if(v ~= tbl2[k]) then
return false
end
end
end
return true
end
@Velkon
Copy link

Velkon commented Sep 10, 2015

Cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment