diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-04-14 07:50:36 +0200 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-04-14 07:56:46 +0200 |
commit | b711f32eee2e0c696cb0e621f54e38c398c7090a (patch) | |
tree | 5c99b4510570789dd9d72cd4c0de357edeaaae23 /src/ldebug.js | |
parent | 127ca3042ce2be23bd0b07570154c81ac3fda432 (diff) | |
download | fengari-b711f32eee2e0c696cb0e621f54e38c398c7090a.tar.gz fengari-b711f32eee2e0c696cb0e621f54e38c398c7090a.tar.bz2 fengari-b711f32eee2e0c696cb0e621f54e38c398c7090a.zip |
debug.getuservalue, debug.setuservalue, debug.setlocal
Diffstat (limited to 'src/ldebug.js')
-rw-r--r-- | src/ldebug.js | 15 |
1 files changed, 15 insertions, 0 deletions
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; |