From b711f32eee2e0c696cb0e621f54e38c398c7090a Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Fri, 14 Apr 2017 07:50:36 +0200 Subject: debug.getuservalue, debug.setuservalue, debug.setlocal --- src/ldebug.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/ldebug.js') diff --git a/src/ldebug.js b/src/ldebug.js index 713a0fb..44410a6 100644 --- a/src/ldebug.js +++ b/src/ldebug.js @@ -116,6 +116,20 @@ const lua_getlocal = function(L, ar, n) { return name; }; +const lua_setlocal = function(L, ar, n) { + swapextra(L); + let local = findlocal(L, ar.i_ci, n); + let name = local.name; + let pos = local.pos; + if (name) { + L.stack[pos].type = L.stack[L.top - 1].type; + L.stack[pos].value = L.stack[L.top - 1].value; + L.top--; /* pop value */ + } + swapextra(L); + return name; +}; + const funcinfo = function(ar, cl) { if (cl === null || cl.type === CT.LUA_TCCL) { ar.source = lua.to_luastring("=[JS]"); @@ -574,3 +588,4 @@ module.exports.luaG_typeerror = luaG_typeerror; module.exports.lua_getinfo = lua_getinfo; module.exports.lua_getlocal = lua_getlocal; module.exports.lua_getstack = lua_getstack; +module.exports.lua_setlocal = lua_setlocal; -- cgit v1.2.3-54-g00ecf