moonsharp-devs / moonsharp

An interpreter for the Lua language, written entirely in C# for the .NET, Mono, Xamarin and Unity3D platforms, including handy remote debugger facilities.
http://www.moonsharp.org
Other
1.41k stars 213 forks source link

DynValue ToString uses InvariantCulture #327

Open KiwifruitDev opened 1 year ago

KiwifruitDev commented 1 year ago

Performing this change allows decimal values to concatenate through strings correctly. When a user's Windows regional format uses , for decimal separation, MoonSharp does not handle it in this instance. For my purposes, I have a software that uses MoonSharp for FFmpeg operations. This is a snippet from a Lua script that does not execute correctly:

-- Cut material to whatthe length from random start
local multiplier = (whatthelength*0.75)
local start = functions.randomDouble(0, materiallength - multiplier)
functions.runFFmpeg("-ss " .. start .. " -i \"" .. material .. "\" -t " .. multiplier .. " -c:v libx264 -preset ultrafast -crf 18 -vf scale=" .. options.width .. ":" .. options.height .. ",setsar=1:1,fps=fps=30 -y \"" .. temp2 .. "\"")

The values start and multiplier may not output in a valid format, resulting in this error:

Invalid duration specification for ss: 0,5253521033538923

After these changes were made, the issue no longer occurs. This may be considered a duplicate or continuation of #295.