From 3dfb0dec2b5d519287ef09aac15f405c07770c71 Mon Sep 17 00:00:00 2001 From: Christian Heinrich Date: Thu, 23 Jul 2015 15:17:30 +0200 Subject: [PATCH] [Lua] Fixed integer/double conversion problem - This bug would change integers to doubles when lua was used to actually run the simulation --- src/bindings/lua/lua_state_cloner.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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)); } /** -- 2.20.1