Closed anotak closed 4 years ago
so apparently this isn't a problem on newer .NET runtimes, just, i'm stuck with 3.5 for this particular project
@anotak Interesting, does this happen often on your side? The description seems to imply that this is a very rare occurrence limited to 3.5. I'm wondering how impactful this is.
when a user writes a lua script that calls math.randomseed
with a large double
, after the conversion you end up with the exception.
Gotcha, and the way that lua math.randomseed() works is via conversion to an integer, in this case the limitation is int32. So this should only be related to 3.5, though right? Want to make sure any changes are specific here.
@anotak We are looking at this, but currently I don't think we will be pushing a fix for this because of the NET35 specificity. You could override this and implement the checks on your side for the time being, I will reopen this if we decide to go that route.
try with anything greater than int.MaxValue
here's the relevant line https://github.com/xanathar/moonsharp/blob/master/src/MoonSharp.Interpreter/CoreLib/MathModule.cs#L288
this 9 year old stackoverflow post might be of interest https://stackoverflow.com/questions/1148278/bug-in-system-random-constructor
throws