summaryrefslogtreecommitdiff
path: root/src/luaconf.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-29 01:47:51 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-29 01:47:51 +1100
commitc260105662e28778fe129a3a4500c1baf40ea109 (patch)
treea1319893452111e7d62a23fe738bea44ec5b47f4 /src/luaconf.js
parent618d00711d4fe7c602bad4fa9da1a2a3482142d3 (diff)
downloadfengari-c260105662e28778fe129a3a4500c1baf40ea109.tar.gz
fengari-c260105662e28778fe129a3a4500c1baf40ea109.tar.bz2
fengari-c260105662e28778fe129a3a4500c1baf40ea109.zip
src/lvm.js: Optimise lua_integer2str and lua_number2str
Diffstat (limited to 'src/luaconf.js')
-rw-r--r--src/luaconf.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/luaconf.js b/src/luaconf.js
index 5331720..0843703 100644
--- a/src/luaconf.js
+++ b/src/luaconf.js
@@ -1,7 +1,5 @@
"use strict";
-const sprintf = require('sprintf-js').sprintf;
-
const LUA_MAXINTEGER = 2147483647;
const LUA_MININTEGER = -2147483648;
@@ -22,11 +20,11 @@ const LUAI_MAXSTACK = 100000;
const LUA_IDSIZE = 60-1; /* fengari uses 1 less than lua as we don't embed the null byte */
const lua_integer2str = function(n) {
- return sprintf(LUA_INTEGER_FMT, n);
+ return String(n); /* should match behaviour of LUA_INTEGER_FMT */
};
const lua_number2str = function(n) {
- return sprintf(LUA_NUMBER_FMT, n);
+ return String(Number(n.toPrecision(n))); /* should match behaviour of LUA_NUMBER_FMT */
};
const lua_numbertointeger = function(n) {