From c260105662e28778fe129a3a4500c1baf40ea109 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 29 Dec 2017 01:47:51 +1100 Subject: src/lvm.js: Optimise lua_integer2str and lua_number2str --- src/luaconf.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/luaconf.js') 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) { -- cgit v1.2.3-54-g00ecf