aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-22 23:08:21 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-23 00:51:59 +1000
commit7d849c2df476c92a09ed4067117b5d5e3d5d988e (patch)
tree8e0ad2c04cbdd2465b5f61d7f2069c64716edbeb /src
parentac706a718bb39aefdac1a9fa2bb37f94ecc4245c (diff)
downloadfengari-7d849c2df476c92a09ed4067117b5d5e3d5d988e.tar.gz
fengari-7d849c2df476c92a09ed4067117b5d5e3d5d988e.tar.bz2
fengari-7d849c2df476c92a09ed4067117b5d5e3d5d988e.zip
src/lstrlib: math.mininteger has to print specially
Diffstat (limited to 'src')
-rw-r--r--src/lstrlib.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lstrlib.js b/src/lstrlib.js
index 8bc2b0e..8e8b58e 100644
--- a/src/lstrlib.js
+++ b/src/lstrlib.js
@@ -225,7 +225,10 @@ const addliteral = function(L, b, arg) {
checkdp(b); /* ensure it uses a dot */
} else { /* integers */
let n = lua.lua_tointeger(L, arg);
- concat(b, lua.to_luastring(sprintf("%d", n)));
+ let format = (n === llimit.LUA_MININTEGER) /* corner case? */
+ ? "0x%" + luaconf.LUA_INTEGER_FRMLEN + "x" /* use hexa */
+ : luaconf.LUA_INTEGER_FMT; /* else use default format */
+ concat(b, lua.to_luastring(sprintf(format, n)));
}
break;
}