neolithos / neolua

A Lua implementation for the Dynamic Language Runtime (DLR).
https://neolua.codeplex.com/
Apache License 2.0
466 stars 76 forks source link

Added overloaded atan #160

Closed dlamkins closed 1 year ago

dlamkins commented 1 year ago

Lua 5.3 deprecated math.atan2(y, x). Most IDEs have begun showing a warning about this.

Lua 5.3 also added a new overload math.atan(y [, x]), which now accepts two parameters making it the intended replacement for math.atan2(y, x):

Deprecations in 5.3: https://www.lua.org/manual/5.3/manual.html#8.2 math.atan(y [, x]) in 5.3: http://www.lua.org/manual/5.3/manual.html#pdf-math.atan

I think normally it would make sense to provide a default value (shown below) to keep it a single function instead of requiring the overload, but because the existing parameter is named x, it would break any scripts which manually specify the parameter name.

public static double atan(double y, double x = 1)
            => Math.Atan2(y, x);
neolithos commented 1 year ago

Thank you.