diff options
author | shmuz <shmuz> | 2007-04-21 20:19:53 +0000 |
---|---|---|
committer | shmuz <shmuz> | 2007-04-21 20:19:53 +0000 |
commit | 703cdc1af2edb65dfab7b34936a275fd2bc284b8 (patch) | |
tree | d33a1d8fcfc1e01e6134b003ee95e6ee8b7e8e01 /test | |
parent | 013a4c2fbc2248d8ddd203462fb945cdc5e1f235 (diff) | |
download | lrexlib-703cdc1af2edb65dfab7b34936a275fd2bc284b8.tar.gz |
(eq): no more relying on tostring giving different strings for different tables.
Diffstat (limited to 'test')
-rwxr-xr-x | test/luatest.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/luatest.lua b/test/luatest.lua index d01ff31..f357e00 100755 --- a/test/luatest.lua +++ b/test/luatest.lua @@ -10,10 +10,10 @@ function eq (t1, t2, lut) end lut = lut or {} -- look-up table: are these 2 arrays already compared? - local s1, s2 = tostring (t1), tostring (t2) - local key = s1 < s2 and s1.."\0"..s2 or s2.."\0"..s1 - if lut[key] then return true end - lut[key] = true + lut[t1] = lut[t1] or {} + if lut[t1][t2] then return true end + lut[t2] = lut[t2] or {} + lut[t1][t2], lut[t2][t1] = true, true for k,v in ipairs (t1) do if not eq (t2[k], v, lut) then return false end -- recursion |