From 888c1286cfe25c1b21605c3443cc0a20b522972b Mon Sep 17 00:00:00 2001 From: daurnimator Date: Tue, 23 May 2017 17:37:20 +1000 Subject: Introduce setobj2s --- src/lobject.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/lobject.js') diff --git a/src/lobject.js b/src/lobject.js index 7b8a332..3a442ee 100644 --- a/src/lobject.js +++ b/src/lobject.js @@ -189,6 +189,10 @@ class TValue { const setobjs2s = function(L, newidx, oldidx) { L.stack[newidx] = L.stack[oldidx]; }; +/* to stack (not from same stack) */ +const setobj2s = function(L, newidx, oldtv) { + L.stack[newidx] = new TValue(oldtv.type, oldtv.value); +}; const luaO_nilobject = new TValue(CT.LUA_TNIL, null); Object.freeze(luaO_nilobject); @@ -673,3 +677,4 @@ module.exports.luaO_utf8desc = luaO_utf8desc; module.exports.luaO_utf8esc = luaO_utf8esc; module.exports.numarith = numarith; module.exports.setobjs2s = setobjs2s; +module.exports.setobj2s = setobj2s; -- cgit v1.2.3-54-g00ecf