summaryrefslogtreecommitdiff
path: root/src/lobject.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-29 14:13:28 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-29 14:35:56 +1000
commitf87a838f498c2ec6536ba813d7ae83bd1e78a506 (patch)
tree2d8478b46f1a7b4db9a9ee8fe8c25162091395fe /src/lobject.js
parent5e169fc1ed36d9cef5f021b1b8be8867902dbdbb (diff)
downloadfengari-f87a838f498c2ec6536ba813d7ae83bd1e78a506.tar.gz
fengari-f87a838f498c2ec6536ba813d7ae83bd1e78a506.tar.bz2
fengari-f87a838f498c2ec6536ba813d7ae83bd1e78a506.zip
luaO_tostring should modify TValue
Diffstat (limited to 'src/lobject.js')
-rw-r--r--src/lobject.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lobject.js b/src/lobject.js
index 7f81438..db76cb5 100644
--- a/src/lobject.js
+++ b/src/lobject.js
@@ -530,7 +530,7 @@ const luaO_tostring = function(L, obj) {
buff.push(char['0']); /* adds '.0' to result */
}
}
- return lstring.luaS_bless(L, buff);
+ obj.setsvalue(lstring.luaS_bless(L, buff));
};
const pushstr = function(L, str) {
@@ -563,11 +563,13 @@ const luaO_pushvfstring = function(L, fmt, argp) {
case char['d']:
case char['I']:
ldo.luaD_inctop(L);
- setsvalue2s(L, L.top-1, luaO_tostring(L, new TValue(CT.LUA_TNUMINT, argp[a++])));
+ L.stack[L.top-1].setivalue(argp[a++]);
+ luaO_tostring(L, L.stack[L.top-1]);
break;
case char['f']:
ldo.luaD_inctop(L);
- setsvalue2s(L, L.top-1, luaO_tostring(L, new TValue(CT.LUA_TNUMFLT, argp[a++])));
+ L.stack[L.top-1].setfltvalue(argp[a++]);
+ luaO_tostring(L, L.stack[L.top-1]);
break;
case char['p']:
let v = argp[a++];