aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-22 23:28:59 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-23 00:52:07 +1000
commit252284298bce111a7b2e1bea07eef54a7835c422 (patch)
tree48d85ca824b78fdd4a38c16e2c0bd5c720d28796
parent13328c5bee9b847317313491c3eb9f6f66766de7 (diff)
downloadfengari-252284298bce111a7b2e1bea07eef54a7835c422.tar.gz
fengari-252284298bce111a7b2e1bea07eef54a7835c422.tar.bz2
fengari-252284298bce111a7b2e1bea07eef54a7835c422.zip
src/lobject.js: Don't assume LUA_COMPAT_FLOATSTRING
-rw-r--r--src/lobject.js5
1 files changed, 5 insertions, 0 deletions
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));
};