summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-03 12:29:35 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-03 12:29:35 +1000
commitebeb17ee158a3b482bd70c8643eacd166d89b4b5 (patch)
treeb3aaa38420d919897164e38ff532adbef6ee3556
parentcb0295e52870f22c5dd1a1726342b8d4b147b1c5 (diff)
downloadfengari-ebeb17ee158a3b482bd70c8643eacd166d89b4b5.tar.gz
fengari-ebeb17ee158a3b482bd70c8643eacd166d89b4b5.tar.bz2
fengari-ebeb17ee158a3b482bd70c8643eacd166d89b4b5.zip
Add lua_rawseti
-rw-r--r--README.md1
-rw-r--r--src/lapi.js9
2 files changed, 9 insertions, 1 deletions
diff --git a/README.md b/README.md
index dcfafd4..9d7e70e 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,6 @@
- [ ] lua_islightuserdata
- [ ] lua_pushfstring
- [ ] lua_pushvfstring
- - [ ] lua_rawseti
- [ ] lua_register
- [ ] lua_setallocf
- [ ] lua_tocfunction
diff --git a/src/lapi.js b/src/lapi.js
index 4de27c2..826dee2 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -399,6 +399,14 @@ const lua_rawset = function(L, idx) {
L.top -= 2;
};
+const lua_rawseti = function(L, idx, n) {
+ assert(2 < L.top - L.ci.funcOff, "not enough elements in the stack");
+ let o = index2addr(L, idx);
+ assert(o.ttistable(), "table expected");
+ ltable.luaH_setint(o.value, n, L.stack[L.top - 1]);
+ L.stack[--L.top] = void 0;
+};
+
const lua_rawsetp = function(L, idx, p) {
assert(1 < L.top - L.ci.funcOff, "not enough elements in the stack");
let o = index2addr(L, idx);
@@ -1074,6 +1082,7 @@ module.exports.lua_rawgeti = lua_rawgeti;
module.exports.lua_rawgetp = lua_rawgetp;
module.exports.lua_rawlen = lua_rawlen;
module.exports.lua_rawset = lua_rawset;
+module.exports.lua_rawseti = lua_rawseti;
module.exports.lua_rawsetp = lua_rawsetp;
module.exports.lua_remove = lua_remove;
module.exports.lua_replace = lua_replace;