eris: refactoring table API so that table methods can see value being inserted

This commit is contained in:
2021-07-06 19:32:20 -04:00
parent a12133243c
commit 3bf8b1fadb
6 changed files with 40 additions and 56 deletions

View File

@@ -804,7 +804,7 @@ LUA_API void lua_rawset (lua_State *L, int idx) {
api_checknelems(L, 2);
t = index2addr(L, idx);
api_check(L, ttistable(t), "table expected");
setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1);
luaH_setvalue(L, hvalue(t), L->top-2, L->top-1);
invalidateTMcache(hvalue(t));
luaC_barrierback(L, gcvalue(t), L->top-1);
L->top -= 2;
@@ -833,7 +833,7 @@ LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p) {
t = index2addr(L, idx);
api_check(L, ttistable(t), "table expected");
setpvalue(&k, cast(void *, p));
setobj2t(L, luaH_set(L, hvalue(t), &k), L->top - 1);
luaH_setvalue(L, hvalue(t), &k, L->top-1);
luaC_barrierback(L, gcvalue(t), L->top - 1);
L->top--;
lua_unlock(L);