diff --git a/PorygonSharp/EvalValues/EvalValue.cs b/PorygonSharp/EvalValues/EvalValue.cs index 602f6c7..1ddeb63 100644 --- a/PorygonSharp/EvalValues/EvalValue.cs +++ b/PorygonSharp/EvalValues/EvalValue.cs @@ -74,7 +74,10 @@ namespace PorygonSharp.EvalValues case TypeClass.Nil: return null; case TypeClass.Number: - return EvaluateInteger(); + if (IsNumericValueFloat(Handle) == 1) + return EvaluateFloat(); + else + return EvaluateInteger(); case TypeClass.Bool: return EvaluateBool(); case TypeClass.String: @@ -98,6 +101,10 @@ namespace PorygonSharp.EvalValues private static extern int GetTypeClass(IntPtr ptr); [DllImport("PorygonLang", EntryPoint = "GetEvalValueType", CallingConvention = CallingConvention.Cdecl)] private static extern IntPtr GetScriptType(IntPtr ptr); + + [DllImport("PorygonLang", EntryPoint = "IsNumericValueFloat", CallingConvention = CallingConvention.Cdecl)] + private static extern byte IsNumericValueFloat(IntPtr ptr); + [DllImport("PorygonLang", EntryPoint = "EvaluateEvalValueInteger", CallingConvention = CallingConvention.Cdecl)] private static extern long EvaluateInteger(IntPtr ptr); [DllImport("PorygonLang", EntryPoint = "EvaluateEvalValueFloat", CallingConvention = CallingConvention.Cdecl)]