From 252284298bce111a7b2e1bea07eef54a7835c422 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Mon, 22 May 2017 23:28:59 +1000 Subject: src/lobject.js: Don't assume LUA_COMPAT_FLOATSTRING --- src/lobject.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/lobject.js b/src/lobject.js index fad3b73..8c70985 100644 --- a/src/lobject.js +++ b/src/lobject.js @@ -456,6 +456,11 @@ const luaO_tostring = function(L, obj) { 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 */ + } } return new TValue(CT.LUA_TLNGSTR, lstring.luaS_bless(L, buff)); }; -- cgit v1.2.3-54-g00ecf