Created
September 10, 2015 05:36
-
-
Save SwadicalRag/096725742630b8428c49 to your computer and use it in GitHub Desktop.
compare tables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool