diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-13 10:39:55 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-13 10:39:55 -0300 |
commit | 864c96f36ce8410b03652b1cb9800e4b3c76bcf7 (patch) | |
tree | d5061c0babf25cf222953e5195673534f8287f34 /lapi.c | |
parent | 0052930ffe8c86f0df7ab99dd1b6668f9e10c781 (diff) | |
download | lua-864c96f36ce8410b03652b1cb9800e4b3c76bcf7.tar.gz lua-864c96f36ce8410b03652b1cb9800e4b3c76bcf7.tar.bz2 lua-864c96f36ce8410b03652b1cb9800e4b3c76bcf7.zip |
new fallback for equality `__eq'
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.196 2002/06/06 12:40:22 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.197 2002/06/12 14:51:31 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -211,11 +211,24 @@ LUA_API int lua_isstring (lua_State *L, int index) { | |||
211 | } | 211 | } |
212 | 212 | ||
213 | 213 | ||
214 | LUA_API int lua_equal (lua_State *L, int index1, int index2) { | 214 | LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { |
215 | StkId o1 = luaA_indexAcceptable(L, index1); | 215 | StkId o1 = luaA_indexAcceptable(L, index1); |
216 | StkId o2 = luaA_indexAcceptable(L, index2); | 216 | StkId o2 = luaA_indexAcceptable(L, index2); |
217 | return (o1 == NULL || o2 == NULL) ? 0 /* index out of range */ | 217 | return (o1 == NULL || o2 == NULL) ? 0 /* index out of range */ |
218 | : luaO_equalObj(o1, o2); | 218 | : luaO_rawequalObj(o1, o2); |
219 | } | ||
220 | |||
221 | |||
222 | LUA_API int lua_equal (lua_State *L, int index1, int index2) { | ||
223 | StkId o1, o2; | ||
224 | int i; | ||
225 | lua_lock(L); /* may call tag method */ | ||
226 | o1 = luaA_indexAcceptable(L, index1); | ||
227 | o2 = luaA_indexAcceptable(L, index2); | ||
228 | i = (o1 == NULL || o2 == NULL) ? 0 /* index out of range */ | ||
229 | : equalobj(L, o1, o2); | ||
230 | lua_unlock(L); | ||
231 | return i; | ||
219 | } | 232 | } |
220 | 233 | ||
221 | 234 | ||