aboutsummaryrefslogtreecommitdiff
path: root/src/lua/lmathlib.c
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2021-03-03 21:31:01 +0800
committerLi Jin <dragon-fly@qq.com>2021-03-03 21:33:37 +0800
commit1df786307c1983b8ce693e3916081a8bcd4e95ae (patch)
tree6c7aeb2198d825877fd3d179c394b7a5c1f06a17 /src/lua/lmathlib.c
parent66168b112b707172b9035edf8c1daed469781e06 (diff)
downloadyuescript-1df786307c1983b8ce693e3916081a8bcd4e95ae.tar.gz
yuescript-1df786307c1983b8ce693e3916081a8bcd4e95ae.tar.bz2
yuescript-1df786307c1983b8ce693e3916081a8bcd4e95ae.zip
add new metatable syntax for issue #41, fix reusing local variable issue, update built-in Lua.
Diffstat (limited to 'src/lua/lmathlib.c')
-rw-r--r--src/lua/lmathlib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lua/lmathlib.c b/src/lua/lmathlib.c
index 86def47..5f5983a 100644
--- a/src/lua/lmathlib.c
+++ b/src/lua/lmathlib.c
@@ -73,7 +73,7 @@ static int math_atan (lua_State *L) {
73static int math_toint (lua_State *L) { 73static int math_toint (lua_State *L) {
74 int valid; 74 int valid;
75 lua_Integer n = lua_tointegerx(L, 1, &valid); 75 lua_Integer n = lua_tointegerx(L, 1, &valid);
76 if (valid) 76 if (l_likely(valid))
77 lua_pushinteger(L, n); 77 lua_pushinteger(L, n);
78 else { 78 else {
79 luaL_checkany(L, 1); 79 luaL_checkany(L, 1);
@@ -175,7 +175,8 @@ static int math_log (lua_State *L) {
175 lua_Number base = luaL_checknumber(L, 2); 175 lua_Number base = luaL_checknumber(L, 2);
176#if !defined(LUA_USE_C89) 176#if !defined(LUA_USE_C89)
177 if (base == l_mathop(2.0)) 177 if (base == l_mathop(2.0))
178 res = l_mathop(log2)(x); else 178 res = l_mathop(log2)(x);
179 else
179#endif 180#endif
180 if (base == l_mathop(10.0)) 181 if (base == l_mathop(10.0))
181 res = l_mathop(log10)(x); 182 res = l_mathop(log10)(x);