mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 01:09:50 +00:00
Fixed: Use lua_tointeger under Lua 5.2 and prior versions
--HG-- branch : develop
This commit is contained in:
parent
f068c6ff66
commit
b3cfd5f6bb
1 changed files with 5 additions and 0 deletions
|
@ -253,7 +253,9 @@ inline lua_Integer CLuaState::toInteger(int index)
|
||||||
{
|
{
|
||||||
//H_AUTO(Lua_CLuaState_toInteger)
|
//H_AUTO(Lua_CLuaState_toInteger)
|
||||||
checkIndex(index);
|
checkIndex(index);
|
||||||
|
#if LUA_VERSION_NUM >= 503
|
||||||
sint isnum = 0;
|
sint isnum = 0;
|
||||||
|
// lua_tointeger fails with decimal numbers under Lua 5.3
|
||||||
lua_Integer res = lua_tointegerx(_State, index, &isnum);
|
lua_Integer res = lua_tointegerx(_State, index, &isnum);
|
||||||
if (!isnum)
|
if (!isnum)
|
||||||
{
|
{
|
||||||
|
@ -262,6 +264,9 @@ inline lua_Integer CLuaState::toInteger(int index)
|
||||||
res = (lua_Integer)d;
|
res = (lua_Integer)d;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
#else
|
||||||
|
return lua_tointeger(_State, index);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
Loading…
Reference in a new issue