diff options
Diffstat (limited to 'src/compat52.h')
-rw-r--r-- | src/compat52.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compat52.h b/src/compat52.h index 163aecb..9b0a48e 100644 --- a/src/compat52.h +++ b/src/compat52.h @@ -29,6 +29,16 @@ #define lua_getfield(L, i, f) (lua_getfield(L, (i), (f)), lua_type(L, -1)) +static int lua_isinteger(lua_State *L, int index) { + if (lua_type(L, index) == LUA_TNUMBER) { + lua_Number n = lua_tonumber(L, index); + lua_Integer i = lua_tointeger(L, index); + if (i == n) + return 1; + } + return 0; +} + #endif #if LUA_VERSION_NUM < 502 |