From 6ba5df0961779e1e9f8347e1f26091b8c63e105f Mon Sep 17 00:00:00 2001 From: daurnimator Date: Wed, 13 Dec 2017 11:17:59 +1100 Subject: src/lobject.js: Build string in js rather than appending to lua string --- src/lobject.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lobject.js b/src/lobject.js index a67147a..a70866d 100644 --- a/src/lobject.js +++ b/src/lobject.js @@ -508,12 +508,11 @@ const luaO_tostring = function(L, obj) { buff = defs.to_luastring(luaconf.lua_integer2str(obj.value)); else { let str = luaconf.lua_number2str(obj.value); - buff = defs.to_luastring(str); // Assume no LUA_COMPAT_FLOATSTRING if (/^[-0123456789]+$/.test(str)) { /* looks like an int? */ - buff.push(char[luaconf.lua_getlocaledecpoint()]); - buff.push(char['0']); /* adds '.0' to result */ + str += luaconf.lua_getlocaledecpoint() + '0'; /* adds '.0' to result */ } + buff = defs.to_luastring(str); } obj.setsvalue(lstring.luaS_bless(L, buff)); }; -- cgit v1.2.3-70-g09d2