From 01b6fe0cbfe59fe74b255ede51806a574f5cf447 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 25 Apr 2013 10:52:49 -0300 Subject: [PATCH] new API function 'lua_isinteger' --- lapi.c | 8 +++++++- lua.h | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lapi.c b/lapi.c index 60e3a1ee..f0e219b4 100644 --- a/lapi.c +++ b/lapi.c @@ -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); diff --git a/lua.h b/lua.h index 7e898918..c1efd9a1 100644 --- a/lua.h +++ b/lua.h @@ -1,5 +1,5 @@ /* -** $Id: lua.h,v 1.284 2013/02/19 18:39:04 roberto Exp roberto $ +** $Id: lua.h,v 1.285 2013/03/15 13:04:22 roberto Exp roberto $ ** Lua - A Scripting Language ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) ** See Copyright Notice at the end of this file @@ -161,6 +161,7 @@ LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); LUA_API int (lua_isnumber) (lua_State *L, int idx); LUA_API int (lua_isstring) (lua_State *L, int idx); LUA_API int (lua_iscfunction) (lua_State *L, int idx); +LUA_API int (lua_isinteger) (lua_State *L, int idx); LUA_API int (lua_isuserdata) (lua_State *L, int idx); LUA_API int (lua_type) (lua_State *L, int idx); LUA_API const char *(lua_typename) (lua_State *L, int tp);