lua_isnumber
LUA_API int (lua_isnumber) (lua_State *L, int idx);
if (lua_isnumber(state, -2) && lua_tointeger(state, -2) > 0) {