diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-06-10 15:53:18 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-06-10 15:53:18 -0300 |
commit | 1a3656e56eb1c873a4d74661eb44c96c07d662c1 (patch) | |
tree | b5622ff8a45cc79a982b06540ea0df8427decca0 /ltm.c | |
parent | 542b6cfc02d57e66db7afc23a1d8350ae189e3c6 (diff) | |
download | lua-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.c | 15 |
1 files changed, 1 insertions, 14 deletions
@@ -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 | ||
132 | const 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 | |||
145 | int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2, | 132 | int 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)) |