From: Christian Heinrich Date: Thu, 23 Jul 2015 13:17:30 +0000 (+0200) Subject: [Lua] Fixed integer/double conversion problem X-Git-Tag: v3_13~1644^2~23 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3dfb0dec2b5d519287ef09aac15f405c07770c71 [Lua] Fixed integer/double conversion problem - This bug would change integers to doubles when lua was used to actually run the simulation --- diff --git a/src/bindings/lua/lua_state_cloner.c b/src/bindings/lua/lua_state_cloner.c index 47f8b4f804..dfee7ed349 100644 --- a/src/bindings/lua/lua_state_cloner.c +++ b/src/bindings/lua/lua_state_cloner.c @@ -259,7 +259,12 @@ static void sglua_copy_nil(lua_State* src, lua_State* dst) { * @param dst destination state */ static void sglua_copy_number(lua_State* src, lua_State* dst) { - lua_pushnumber(dst, lua_tonumber(src, -1)); + lua_Number n = lua_tonumber(src, -1); + if ( ((lua_Integer) n) == n) { + lua_pushinteger(dst, lua_tointeger(src, -1)); + } + else + lua_pushnumber(dst, lua_tonumber(src, -1)); } /**