summaryrefslogtreecommitdiff
path: root/src/lmathlib.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-04-19 18:12:07 +1000
committerdaurnimator <quae@daurnimator.com>2017-04-19 18:12:07 +1000
commit662381f6669f28f90a1d50c89647d265ca3804a4 (patch)
tree5ae3bce5dcf2a83302618280163d3088e5d090f8 /src/lmathlib.js
parent4d596650dff0417660874727964a32dae23dc9ea (diff)
parent6be8db07196c407cd321a7b04f5022939c4ffce3 (diff)
downloadfengari-662381f6669f28f90a1d50c89647d265ca3804a4.tar.gz
fengari-662381f6669f28f90a1d50c89647d265ca3804a4.tar.bz2
fengari-662381f6669f28f90a1d50c89647d265ca3804a4.zip
Merge branch 'master' into cli
Diffstat (limited to 'src/lmathlib.js')
-rw-r--r--src/lmathlib.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lmathlib.js b/src/lmathlib.js
index 500331b..c052fcb 100644
--- a/src/lmathlib.js
+++ b/src/lmathlib.js
@@ -37,13 +37,13 @@ const math_random = function(L) {
up = lauxlib.luaL_checkinteger(L, 2);
break;
}
- default: return lauxlib.luaL_error(L, lua.to_luastring("wrong number of arguments"));
+ default: return lauxlib.luaL_error(L, lua.to_luastring("wrong number of arguments", true));
}
/* random integer in the interval [low, up] */
- lauxlib.luaL_argcheck(L, low <= up, 1, lua.to_luastring("interval is empty"));
+ lauxlib.luaL_argcheck(L, low <= up, 1, lua.to_luastring("interval is empty", true));
lauxlib.luaL_argcheck(L, low >= 0 || up <= Number.MAX_SAFE_INTEGER + low, 1,
- lua.to_luastring("interval too large"));
+ lua.to_luastring("interval too large", true));
r *= (up - low) + 1;
lapi.lua_pushinteger(L, r + low);
@@ -173,7 +173,7 @@ const math_rad = function(L) {
const math_min = function(L) {
let n = lapi.lua_gettop(L); /* number of arguments */
let imin = 1; /* index of current minimum value */
- lauxlib.luaL_argcheck(L, n >= 1, 1, lua.to_luastring("value expected"));
+ lauxlib.luaL_argcheck(L, n >= 1, 1, lua.to_luastring("value expected", true));
for (let i = 2; i <= n; i++){
if (lapi.lua_compare(L, i, imin, lua.LUA_OPLT))
imin = i;
@@ -185,7 +185,7 @@ const math_min = function(L) {
const math_max = function(L) {
let n = lapi.lua_gettop(L); /* number of arguments */
let imax = 1; /* index of current minimum value */
- lauxlib.luaL_argcheck(L, n >= 1, 1, lua.to_luastring("value expected"));
+ lauxlib.luaL_argcheck(L, n >= 1, 1, lua.to_luastring("value expected", true));
for (let i = 2; i <= n; i++){
if (lapi.lua_compare(L, imax, i, lua.LUA_OPLT))
imax = i;
@@ -211,7 +211,7 @@ const math_fmod = function(L) {
if (lapi.lua_isinteger(L, 1) && lapi.lua_isinteger(L, 2)) {
let d = lapi.lua_tointeger(L, 2);
if (Math.abs(d) + 1 <= 1) {
- lauxlib.luaL_argcheck(L, d !== 0, 2, lua.to_luastring("zero"));
+ lauxlib.luaL_argcheck(L, d !== 0, 2, lua.to_luastring("zero", true));
lapi.lua_pushinteger(L, 0);
} else
lapi.lua_pushinteger(L, lapi.lua_tointeger(L, 1) % d);
@@ -265,13 +265,13 @@ const mathlib = {
const luaopen_math = function(L) {
lauxlib.luaL_newlib(L, mathlib);
lapi.lua_pushnumber(L, Math.PI);
- lapi.lua_setfield(L, -2, lua.to_luastring("pi"));
+ lapi.lua_setfield(L, -2, lua.to_luastring("pi", true));
lapi.lua_pushnumber(L, Number.MAX_VALUE);
- lapi.lua_setfield(L, -2, lua.to_luastring("huge"));
+ lapi.lua_setfield(L, -2, lua.to_luastring("huge", true));
lapi.lua_pushinteger(L, Number.MAX_SAFE_INTEGER);
- lapi.lua_setfield(L, -2, lua.to_luastring("maxinteger"));
+ lapi.lua_setfield(L, -2, lua.to_luastring("maxinteger", true));
lapi.lua_pushinteger(L, Number.MIN_SAFE_INTEGER);
- lapi.lua_setfield(L, -2, lua.to_luastring("mininteger"));
+ lapi.lua_setfield(L, -2, lua.to_luastring("mininteger", true));
return 1;
};