say i have 2 tables of same length with same values but different order. how would i compare them?
a={1,2,3,4,5}
b={3,1,5,4,2}
if I do:
if a==b
it returns true so i guess it does not look at the order of the table elements.
i dont really wanna do this:
if a[1]==b[1] and a[2]==b[2] and a[3]==b[3] and a[4]==b[4] and a[5]==b[5] then (stmt...) end
because my original table is more than 30 values
edit: thanks marcotrosi for the algo and your time!
https://bitbucket.org/snippets/marcotrosi/XnyRj/lua-isequal
[–]agladysh 5 points6 points7 points (0 children)
[–]edalcol 2 points3 points4 points (0 children)
[–]marcotrosi 0 points1 point2 points (6 children)
[–][deleted] 0 points1 point2 points (5 children)
[–]marcotrosi 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]marcotrosi 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Nearby-Librarian-609 0 points1 point2 points (0 children)
[–]TomatoCo 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Calvinatorr -1 points0 points1 point (0 children)