From 54ca44894b7eec030133873edfa229960ee6b9c1 Mon Sep 17 00:00:00 2001 From: Daniel Brady Date: Tue, 22 Sep 2020 09:09:05 -0400 Subject: [PATCH] enhancement(table.basically_the_same): Check object equality --- table.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/table.lua b/table.lua index 9f2b85e..c2f6dc9 100644 --- a/table.lua +++ b/table.lua @@ -494,6 +494,11 @@ end function module.basically_the_same(t1, t2) assert(type(t1) == "table" and type(t2) == "table") + if t1 == t2 then + -- They're actually the same. + return true + end + -- NOTE(dabrady) If the two tables are lists and have the same length, -- we could short-circuit one of these loops. But determining whether -- they are lists is more expensive than just doing the two loops here.