Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Lua/CodeAnalysis/Syntax/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ static double ConvertTextToNumber(ReadOnlySpan<char> text)
}
else
{
return double.Parse(text);
return double.Parse(text, NumberStyles.Float, CultureInfo.InvariantCulture);
}
}
}
3 changes: 2 additions & 1 deletion src/Lua/LuaValue.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Lua.Internal;
Expand Down Expand Up @@ -120,7 +121,7 @@ public bool TryRead<T>(out T result)
}
else
{
var tryResult = double.TryParse(str, out var d);
var tryResult = double.TryParse(str, NumberStyles.Float, CultureInfo.InvariantCulture, out var d);
result = tryResult ? Unsafe.As<double, T>(ref d) : default!;
return tryResult;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Lua/Standard/BasicLibrary.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Globalization;
using Lua.CodeAnalysis.Compilation;
using Lua.Internal;
using Lua.Runtime;
Expand Down Expand Up @@ -445,7 +446,7 @@ public ValueTask<int> ToNumber(LuaFunctionExecutionContext context, Memory<LuaVa
}
else if (toBase == 10)
{
if (double.TryParse(str, out var result))
if (double.TryParse(str, NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
{
value = result;
}
Expand Down