no need for two different implementations for equality (one raw and
one with metamethods)
This commit is contained in:
24
lobject.c
24
lobject.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lobject.c,v 2.47 2011/04/05 18:32:06 roberto Exp roberto $
|
||||
** $Id: lobject.c,v 2.48 2011/05/03 16:01:57 roberto Exp roberto $
|
||||
** Some generic functions over Lua objects
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -70,28 +70,6 @@ int luaO_ceillog2 (unsigned int x) {
|
||||
}
|
||||
|
||||
|
||||
int luaO_rawequalObj (const TValue *t1, const TValue *t2) {
|
||||
if (!ttisequal(t1, t2)) return 0;
|
||||
else switch (ttype(t1)) {
|
||||
case LUA_TNIL:
|
||||
return 1;
|
||||
case LUA_TNUMBER:
|
||||
return luai_numeq(nvalue(t1), nvalue(t2));
|
||||
case LUA_TBOOLEAN:
|
||||
return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */
|
||||
case LUA_TLIGHTUSERDATA:
|
||||
return pvalue(t1) == pvalue(t2);
|
||||
case LUA_TSTRING:
|
||||
return rawtsvalue(t1) == rawtsvalue(t2);
|
||||
case LUA_TLCF:
|
||||
return fvalue(t1) == fvalue(t2);
|
||||
default:
|
||||
lua_assert(iscollectable(t1));
|
||||
return gcvalue(t1) == gcvalue(t2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
lua_Number luaO_arith (int op, lua_Number v1, lua_Number v2) {
|
||||
switch (op) {
|
||||
case LUA_OPADD: return luai_numadd(NULL, v1, v2);
|
||||
|
||||
Reference in New Issue
Block a user