summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-13 11:17:59 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-13 15:03:58 +1100
commit6ba5df0961779e1e9f8347e1f26091b8c63e105f (patch)
tree5bf8be1fa680ec1f2ba4e91093da6bcdd588a71a /src
parent75b13045f938dd66069cae34643bab2deafe2138 (diff)
downloadfengari-6ba5df0961779e1e9f8347e1f26091b8c63e105f.tar.gz
fengari-6ba5df0961779e1e9f8347e1f26091b8c63e105f.tar.bz2
fengari-6ba5df0961779e1e9f8347e1f26091b8c63e105f.zip
src/lobject.js: Build string in js rather than appending to lua string
Diffstat (limited to 'src')
-rw-r--r--src/lobject.js5
1 files changed, 2 insertions, 3 deletions
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));
};