summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorshmuz <shmuz>2007-04-21 20:19:53 +0000
committershmuz <shmuz>2007-04-21 20:19:53 +0000
commit703cdc1af2edb65dfab7b34936a275fd2bc284b8 (patch)
treed33a1d8fcfc1e01e6134b003ee95e6ee8b7e8e01 /test
parent013a4c2fbc2248d8ddd203462fb945cdc5e1f235 (diff)
downloadlrexlib-703cdc1af2edb65dfab7b34936a275fd2bc284b8.tar.gz
(eq): no more relying on tostring giving different strings for different tables.
Diffstat (limited to 'test')
-rwxr-xr-xtest/luatest.lua8
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