mirror of https://github.com/rusefi/lua.git
This commit is contained in:
parent
f379d06e24
commit
b3959d58ff
32
lapi.c
32
lapi.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lapi.c,v 1.108 2000/10/24 19:19:15 roberto Exp roberto $
|
** $Id: lapi.c,v 1.109 2000/10/26 12:47:05 roberto Exp roberto $
|
||||||
** Lua API
|
** Lua API
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -108,26 +108,23 @@ LUA_API void lua_pushvalue (lua_State *L, int index) {
|
||||||
|
|
||||||
LUA_API int lua_type (lua_State *L, int index) {
|
LUA_API int lua_type (lua_State *L, int index) {
|
||||||
StkId o = luaA_indexAcceptable(L, index);
|
StkId o = luaA_indexAcceptable(L, index);
|
||||||
if (o == NULL) return LUA_TNONE;
|
return (o == NULL) ? LUA_TNONE : ttype(o);
|
||||||
else return ttype(o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LUA_API const char *lua_typename (lua_State *L, int t) {
|
LUA_API const char *lua_typename (lua_State *L, int t) {
|
||||||
UNUSED(L);
|
UNUSED(L);
|
||||||
return luaO_typenames[t];
|
return (t == LUA_TNONE) ? "no value" : luaO_typenames[t];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LUA_API int lua_iscfunction (lua_State *L, int index) {
|
LUA_API int lua_iscfunction (lua_State *L, int index) {
|
||||||
StkId o = luaA_indexAcceptable(L, index);
|
StkId o = luaA_indexAcceptable(L, index);
|
||||||
if (o == NULL) return 0;
|
return (o == NULL) ? 0 : iscfunction(o);
|
||||||
else return iscfunction(o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LUA_API int lua_isnumber (lua_State *L, int index) {
|
LUA_API int lua_isnumber (lua_State *L, int index) {
|
||||||
TObject *o = luaA_indexAcceptable(L, index);
|
TObject *o = luaA_indexAcceptable(L, index);
|
||||||
if (o == NULL) return 0;
|
return (o == NULL) ? 0 : (tonumber(o) == 0);
|
||||||
else return (tonumber(o) == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LUA_API int lua_isstring (lua_State *L, int index) {
|
LUA_API int lua_isstring (lua_State *L, int index) {
|
||||||
|
@ -138,8 +135,7 @@ LUA_API int lua_isstring (lua_State *L, int index) {
|
||||||
|
|
||||||
LUA_API int lua_tag (lua_State *L, int index) {
|
LUA_API int lua_tag (lua_State *L, int index) {
|
||||||
StkId o = luaA_indexAcceptable(L, index);
|
StkId o = luaA_indexAcceptable(L, index);
|
||||||
if (o == NULL) return LUA_NOTAG;
|
return (o == NULL) ? LUA_NOTAG : luaT_tag(o);
|
||||||
else return luaT_tag(o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LUA_API int lua_equal (lua_State *L, int index1, int index2) {
|
LUA_API int lua_equal (lua_State *L, int index1, int index2) {
|
||||||
|
@ -160,32 +156,28 @@ LUA_API int lua_lessthan (lua_State *L, int index1, int index2) {
|
||||||
|
|
||||||
LUA_API double lua_tonumber (lua_State *L, int index) {
|
LUA_API double lua_tonumber (lua_State *L, int index) {
|
||||||
StkId o = luaA_indexAcceptable(L, index);
|
StkId o = luaA_indexAcceptable(L, index);
|
||||||
if (o == NULL || tonumber(o)) return 0;
|
return (o == NULL || tonumber(o)) ? 0 : nvalue(o);
|
||||||
else return nvalue(o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LUA_API const char *lua_tostring (lua_State *L, int index) {
|
LUA_API const char *lua_tostring (lua_State *L, int index) {
|
||||||
StkId o = luaA_indexAcceptable(L, index);
|
StkId o = luaA_indexAcceptable(L, index);
|
||||||
if (o == NULL || tostring(L, o)) return NULL;
|
return (o == NULL || tostring(L, o)) ? NULL : svalue(o);
|
||||||
else return svalue(o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LUA_API size_t lua_strlen (lua_State *L, int index) {
|
LUA_API size_t lua_strlen (lua_State *L, int index) {
|
||||||
StkId o = luaA_indexAcceptable(L, index);
|
StkId o = luaA_indexAcceptable(L, index);
|
||||||
if (o == NULL || tostring(L, o)) return 0;
|
return (o == NULL || tostring(L, o)) ? 0 : tsvalue(o)->len;
|
||||||
else return tsvalue(o)->len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index) {
|
LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index) {
|
||||||
StkId o = luaA_indexAcceptable(L, index);
|
StkId o = luaA_indexAcceptable(L, index);
|
||||||
if (o == NULL || !iscfunction(o)) return NULL;
|
return (o == NULL || !iscfunction(o)) ? NULL : clvalue(o)->f.c;
|
||||||
else return clvalue(o)->f.c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LUA_API void *lua_touserdata (lua_State *L, int index) {
|
LUA_API void *lua_touserdata (lua_State *L, int index) {
|
||||||
StkId o = luaA_indexAcceptable(L, index);
|
StkId o = luaA_indexAcceptable(L, index);
|
||||||
if (o == NULL || ttype(o) != LUA_TUSERDATA) return NULL;
|
return (o == NULL || ttype(o) != LUA_TUSERDATA) ? NULL :
|
||||||
else return tsvalue(o)->u.d.value;
|
tsvalue(o)->u.d.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
LUA_API const void *lua_topointer (lua_State *L, int index) {
|
LUA_API const void *lua_topointer (lua_State *L, int index) {
|
||||||
|
|
Loading…
Reference in New Issue