From b3cfd5f6bbb17a1477716b0bf156d2cae27117d5 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 16 Jan 2016 21:35:34 +0100 Subject: [PATCH] Fixed: Use lua_tointeger under Lua 5.2 and prior versions --HG-- branch : develop --- code/nel/include/nel/gui/lua_helper_inline.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/nel/include/nel/gui/lua_helper_inline.h b/code/nel/include/nel/gui/lua_helper_inline.h index df75e6b5b..1d6b4864a 100644 --- a/code/nel/include/nel/gui/lua_helper_inline.h +++ b/code/nel/include/nel/gui/lua_helper_inline.h @@ -253,7 +253,9 @@ inline lua_Integer CLuaState::toInteger(int index) { //H_AUTO(Lua_CLuaState_toInteger) checkIndex(index); +#if LUA_VERSION_NUM >= 503 sint isnum = 0; + // lua_tointeger fails with decimal numbers under Lua 5.3 lua_Integer res = lua_tointegerx(_State, index, &isnum); if (!isnum) { @@ -262,6 +264,9 @@ inline lua_Integer CLuaState::toInteger(int index) res = (lua_Integer)d; } return res; +#else + return lua_tointeger(_State, index); +#endif } //================================================================================