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.

This commit is contained in:
Steve Checkoway
2006-08-10 05:07:16 +00:00
parent 7927af2e37
commit ba9a3d51bf
+2 -1
View File
@@ -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 );