aboutsummaryrefslogtreecommitdiff
path: root/src/lstrlib.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-06-09 14:29:54 +1000
committerdaurnimator <quae@daurnimator.com>2017-06-09 14:29:54 +1000
commit8f188fb2f792223f1a0c1730bd4ac99418d81d74 (patch)
tree6c5606d38263e6a36b9d6baf47f2804e6ac7511f /src/lstrlib.js
parent74dd47160960b3f0faa13dd1b61b64af69fde02e (diff)
downloadfengari-8f188fb2f792223f1a0c1730bd4ac99418d81d74.tar.gz
fengari-8f188fb2f792223f1a0c1730bd4ac99418d81d74.tar.bz2
fengari-8f188fb2f792223f1a0c1730bd4ac99418d81d74.zip
Avoid .concat where simple to do so
Diffstat (limited to 'src/lstrlib.js')
-rw-r--r--src/lstrlib.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lstrlib.js b/src/lstrlib.js
index 0fb8631..4b83ac1 100644
--- a/src/lstrlib.js
+++ b/src/lstrlib.js
@@ -103,10 +103,10 @@ const num2straux = function(x) {
return lua.to_luastring('nan', true).slice(0);
else if (x === 0) { /* can be -0... */
/* create "0" or "-0" followed by exponent */
- let zero = sprintf(luaconf.LUA_NUMBER_FMT + "x0p+0", x).split('').map(e => e.charCodeAt(0));
+ let zero = sprintf(luaconf.LUA_NUMBER_FMT + "x0p+0", x);
if (Object.is(x, -0))
- return ['-'.charCodeAt(0)].concat(zero);
- return zero;
+ zero = "-" + zero;
+ return lua.to_luastring(zero);
} else {
let buff = [];
let fe = luaconf.frexp(x); /* 'x' fraction and exponent */