aboutsummaryrefslogtreecommitdiff
path: root/src/lapi.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-20 11:58:46 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-20 12:03:47 +0100
commit6d3d22b3938a811bdde9a311753837003df42d08 (patch)
tree11a8c9943d4ba6295200fe906c54333732aa37b2 /src/lapi.js
parente0d4ffcc75a04b3ecc2cc08aea372d9621e5b6ac (diff)
downloadfengari-6d3d22b3938a811bdde9a311753837003df42d08.tar.gz
fengari-6d3d22b3938a811bdde9a311753837003df42d08.tar.bz2
fengari-6d3d22b3938a811bdde9a311753837003df42d08.zip
rawset, rawget
Diffstat (limited to 'src/lapi.js')
-rw-r--r--src/lapi.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lapi.js b/src/lapi.js
index 95eb6f7..bb6c224 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -299,6 +299,14 @@ const lua_setfield = function(L, idx, k) {
auxsetstr(L, index2addr(L, idx), k)
};
+const lua_rawset = function(L, idx) {
+ assert(2 < L.top - L.ci.funcOff, "not enough elements in the stack");
+ let o = index2addr(L, idx);
+ assert(o.ttistable(), "table expected");
+ o.__newindex(o, L.stack[L.top - 2], L.stack[L.top - 1]);
+ L.top -= 2;
+};
+
/*
** get functions (Lua -> stack)
*/
@@ -586,6 +594,7 @@ module.exports.lua_gettable = lua_gettable;
module.exports.lua_absindex = lua_absindex;
module.exports.index2addr = index2addr;
module.exports.lua_rawget = lua_rawget;
+module.exports.lua_rawset = lua_rawset;
module.exports.lua_isstring = lua_isstring;
module.exports.lua_rotate = lua_rotate;
module.exports.lua_remove = lua_remove;