new API function 'lua_isinteger'

This commit is contained in:
Roberto Ierusalimschy
2013-04-25 10:52:49 -03:00
parent 944709c77b
commit 01b6fe0cbf
2 changed files with 9 additions and 2 deletions

8
lapi.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 2.172 2013/04/12 19:07:09 roberto Exp roberto $
** $Id: lapi.c,v 2.173 2013/04/15 15:43:34 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -264,6 +264,12 @@ LUA_API int lua_iscfunction (lua_State *L, int idx) {
}
LUA_API int lua_isinteger (lua_State *L, int idx) {
StkId o = index2addr(L, idx);
return ttisinteger(o);
}
LUA_API int lua_isnumber (lua_State *L, int idx) {
TValue n;
const TValue *o = index2addr(L, idx);