summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-22 16:04:19 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-22 16:04:19 +1000
commitedf9e47120f2098458519628335a7e90b2569b70 (patch)
tree8a87cb0b8cc755d5448c3d711062ea7dc8fe3c0a
parentd6e4dc3e7684f32c614fa26b6d66eab57e64eb86 (diff)
downloadfengari-edf9e47120f2098458519628335a7e90b2569b70.tar.gz
fengari-edf9e47120f2098458519628335a7e90b2569b70.tar.bz2
fengari-edf9e47120f2098458519628335a7e90b2569b70.zip
src/lmathlib.js: Implement math.atan second argument
-rw-r--r--src/lmathlib.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lmathlib.js b/src/lmathlib.js
index b10f7bf..32893a6 100644
--- a/src/lmathlib.js
+++ b/src/lmathlib.js
@@ -80,7 +80,9 @@ const math_acos = function(L) {
};
const math_atan = function(L) {
- lua.lua_pushnumber(L, Math.atan(lauxlib.luaL_checknumber(L, 1)));
+ let y = lauxlib.luaL_checknumber(L, 1);
+ let x = lauxlib.luaL_optnumber(L, 2, 1);
+ lua.lua_pushnumber(L, Math.atan2(y, x));
return 1;
};