fix Math.atan2 emitting math.atan2 instead of math.atan for Lua 5.4+ … · TypeScriptToLua/TypeScriptToLua@84ef0b2 · GitHub
Skip to content

Commit 84ef0b2

Browse files
authored
fix Math.atan2 emitting math.atan2 instead of math.atan for Lua 5.4+ (#1700)
* fix Math.atan2 emitting math.atan2 instead of math.atan for Lua 5.4+ math.atan2 was removed in Lua 5.3 (replaced by two-arg math.atan). The codegen only special-cased 5.3 but not 5.4 or 5.5, which also lack math.atan2 (5.4 has it behind a compat flag, 5.5 drops it). * invert atan2 condition to default future Lua targets to math.atan Enumerate the older targets that need math.atan2 instead of the newer ones that need math.atan, so any future Lua target (5.6+) defaults to the modern behavior rather than silently regressing.
1 parent ec26bdf commit 84ef0b2

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎src/transformation/builtins/math.ts‎

Lines changed: 8 additions & 2 deletions

‎test/unit/builtins/math.spec.ts‎

Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)