From edf9e47120f2098458519628335a7e90b2569b70 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Mon, 22 May 2017 16:04:19 +1000 Subject: src/lmathlib.js: Implement math.atan second argument --- src/lmathlib.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') 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; }; -- cgit v1.2.3-70-g09d2