mirror of
https://github.com/lua/lua
synced 2026-09-29 04:35:58 +03:00
new API function `lua_equalobj'
This commit is contained in:
parent
a6755e2f1a
commit
573372665a
3 changed files with 18 additions and 7 deletions
15
lapi.c
15
lapi.c
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lapi.c,v 1.54 1999/10/14 19:13:31 roberto Exp roberto $
|
||||
** $Id: lapi.c,v 1.55 1999/11/04 17:22:26 roberto Exp roberto $
|
||||
** Lua API
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
|
@ -209,15 +209,15 @@ const char *lua_type (lua_Object o) {
|
|||
}
|
||||
|
||||
int lua_isnil (lua_Object o) {
|
||||
return (o!= LUA_NOOBJECT) && (ttype(Address(o)) == LUA_T_NIL);
|
||||
return (o != LUA_NOOBJECT) && (ttype(Address(o)) == LUA_T_NIL);
|
||||
}
|
||||
|
||||
int lua_istable (lua_Object o) {
|
||||
return (o!= LUA_NOOBJECT) && (ttype(Address(o)) == LUA_T_ARRAY);
|
||||
return (o != LUA_NOOBJECT) && (ttype(Address(o)) == LUA_T_ARRAY);
|
||||
}
|
||||
|
||||
int lua_isuserdata (lua_Object o) {
|
||||
return (o!= LUA_NOOBJECT) && (ttype(Address(o)) == LUA_T_USERDATA);
|
||||
return (o != LUA_NOOBJECT) && (ttype(Address(o)) == LUA_T_USERDATA);
|
||||
}
|
||||
|
||||
int lua_iscfunction (lua_Object o) {
|
||||
|
|
@ -225,7 +225,7 @@ int lua_iscfunction (lua_Object o) {
|
|||
}
|
||||
|
||||
int lua_isnumber (lua_Object o) {
|
||||
return (o!= LUA_NOOBJECT) && (tonumber(Address(o)) == 0);
|
||||
return (o != LUA_NOOBJECT) && (tonumber(Address(o)) == 0);
|
||||
}
|
||||
|
||||
int lua_isstring (lua_Object o) {
|
||||
|
|
@ -238,6 +238,11 @@ int lua_isfunction (lua_Object o) {
|
|||
return (t == LUA_T_PROTO) || (t == LUA_T_CPROTO);
|
||||
}
|
||||
|
||||
int lua_equalobj (lua_Object o1, lua_Object o2) {
|
||||
if (o1 == LUA_NOOBJECT || o2 == LUA_NOOBJECT) return 0;
|
||||
else return luaO_equalObj(Address(o1), Address(o2));
|
||||
}
|
||||
|
||||
|
||||
double lua_getnumber (lua_Object object) {
|
||||
if (object == LUA_NOOBJECT) return 0.0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue