aboutsummaryrefslogtreecommitdiff
path: root/ltm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-06-10 15:53:18 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-06-10 15:53:18 -0300
commit1a3656e56eb1c873a4d74661eb44c96c07d662c1 (patch)
treeb5622ff8a45cc79a982b06540ea0df8427decca0 /ltm.c
parent542b6cfc02d57e66db7afc23a1d8350ae189e3c6 (diff)
downloadlua-1a3656e56eb1c873a4d74661eb44c96c07d662c1.tar.gz
lua-1a3656e56eb1c873a4d74661eb44c96c07d662c1.tar.bz2
lua-1a3656e56eb1c873a4d74661eb44c96c07d662c1.zip
more relaxed rules for __eq metamethod (more similar to other
operators)
Diffstat (limited to '')
-rw-r--r--ltm.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/ltm.c b/ltm.c
index 37b5cd3d..dc2e922b 100644
--- a/ltm.c
+++ b/ltm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltm.c,v 2.25 2013/12/30 20:47:58 roberto Exp $ 2** $Id: ltm.c,v 2.26 2014/04/11 20:17:39 roberto Exp roberto $
3** Tag methods 3** Tag methods
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -129,19 +129,6 @@ void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
129} 129}
130 130
131 131
132const TValue *luaT_getequalTM (lua_State *L, Table *mt1, Table *mt2) {
133 const TValue *tm1 = fasttm(L, mt1, TM_EQ);
134 const TValue *tm2;
135 if (tm1 == NULL) return NULL; /* no metamethod */
136 if (mt1 == mt2) return tm1; /* same metatables => same metamethods */
137 tm2 = fasttm(L, mt2, TM_EQ);
138 if (tm2 == NULL) return NULL; /* no metamethod */
139 if (luaV_rawequalobj(tm1, tm2)) /* same metamethods? */
140 return tm1;
141 return NULL;
142}
143
144
145int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2, 132int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2,
146 TMS event) { 133 TMS event) {
147 if (!luaT_callbinTM(L, p1, p2, L->top, event)) 134 if (!luaT_callbinTM(L, p1, p2, L->top, event))