From ba9a3d51bfbf9a9b6c2727353f4bba2a2dfedda6 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Thu, 10 Aug 2006 05:07:16 +0000 Subject: [PATCH] Fix warning about loss of precision. I could just declare it as lua_Number but then do you call truncf (which would likely result in a double to float conversion anyway) or trunc which might convert from float to double if LUA_NUMBER had been defined to be float. --- stepmania/src/LuaManager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stepmania/src/LuaManager.cpp b/stepmania/src/LuaManager.cpp index c233d36dfb..9ff310eb7e 100644 --- a/stepmania/src/LuaManager.cpp +++ b/stepmania/src/LuaManager.cpp @@ -375,7 +375,8 @@ XNode *LuaManager::GetLuaInformation() const } case LUA_TNUMBER: { - float fNum = lua_tonumber( L, -1 ); + // lua_Number is most likely a double unless LUA_NUMBER was defined to be float. + float fNum = float( lua_tonumber(L, -1) ); if( fNum == truncf(fNum) ) mConstants[lua_tostring(L, -2)] = int( fNum );