diff options
author | daurnimator <quae@daurnimator.com> | 2017-12-29 01:47:51 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-12-29 01:47:51 +1100 |
commit | c260105662e28778fe129a3a4500c1baf40ea109 (patch) | |
tree | a1319893452111e7d62a23fe738bea44ec5b47f4 /src | |
parent | 618d00711d4fe7c602bad4fa9da1a2a3482142d3 (diff) | |
download | fengari-c260105662e28778fe129a3a4500c1baf40ea109.tar.gz fengari-c260105662e28778fe129a3a4500c1baf40ea109.tar.bz2 fengari-c260105662e28778fe129a3a4500c1baf40ea109.zip |
src/lvm.js: Optimise lua_integer2str and lua_number2str
Diffstat (limited to 'src')
-rw-r--r-- | src/luaconf.js | 6 |
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) { |