summaryrefslogtreecommitdiff
path: root/src/lapi.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-24 08:13:38 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-24 08:13:38 +0100
commitbd3ffd7282de8236cd4eb2ff2e21bbc10791bfeb (patch)
tree2de6c6153d1cce350402053e364236cecb1c9725 /src/lapi.js
parent8b9545c6b2a158d44e18dcaa1147cc1206eabfd3 (diff)
downloadfengari-bd3ffd7282de8236cd4eb2ff2e21bbc10791bfeb.tar.gz
fengari-bd3ffd7282de8236cd4eb2ff2e21bbc10791bfeb.tar.bz2
fengari-bd3ffd7282de8236cd4eb2ff2e21bbc10791bfeb.zip
table.pack
Diffstat (limited to 'src/lapi.js')
-rw-r--r--src/lapi.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lapi.js b/src/lapi.js
index 6316326..f34216b 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -355,6 +355,13 @@ const lua_setfield = function(L, idx, k) {
auxsetstr(L, index2addr(L, idx), k)
};
+const lua_seti = function(L, idx, n) {
+ assert(1 < L.top - L.ci.funcOff, "not enough elements in the stack");
+ let t = index2addr(L, idx);
+ lvm.settable(L, t, n, L.stack[L.top - 1]);
+ L.top--; /* pop value */
+};
+
const lua_rawset = function(L, idx) {
assert(2 < L.top - L.ci.funcOff, "not enough elements in the stack");
let o = index2addr(L, idx);
@@ -780,6 +787,7 @@ module.exports.lua_remove = lua_remove;
module.exports.lua_rotate = lua_rotate;
module.exports.lua_setfield = lua_setfield;
module.exports.lua_setglobal = lua_setglobal;
+module.exports.lua_seti = lua_seti;
module.exports.lua_setmetatable = lua_setmetatable;
module.exports.lua_settable = lua_settable;
module.exports.lua_settop = lua_settop;