Fixed NumericEvalValues always being evaluated as integers.

This commit is contained in:
Deukhoofd 2019-09-22 13:30:54 +02:00
parent 601fec8048
commit 415f03efc3
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 8 additions and 1 deletions

View File

@ -74,6 +74,9 @@ namespace PorygonSharp.EvalValues
case TypeClass.Nil:
return null;
case TypeClass.Number:
if (IsNumericValueFloat(Handle) == 1)
return EvaluateFloat();
else
return EvaluateInteger();
case TypeClass.Bool:
return EvaluateBool();
@ -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)]