Changes in the API of 'luaH_set' and related functions
Functions to set values in a table (luaH_set, luaH_newkey, etc.) receive the new value, instead of returning a slot where to put the value.
This commit is contained in:
5
lvm.c
5
lvm.c
@@ -337,10 +337,7 @@ void luaV_finishset (lua_State *L, const TValue *t, TValue *key,
|
||||
lua_assert(isempty(slot)); /* slot must be empty */
|
||||
tm = fasttm(L, h->metatable, TM_NEWINDEX); /* get metamethod */
|
||||
if (tm == NULL) { /* no metamethod? */
|
||||
if (isabstkey(slot)) /* no previous entry? */
|
||||
slot = luaH_newkey(L, h, key); /* create one */
|
||||
/* no metamethod and (now) there is an entry with given key */
|
||||
setobj2t(L, cast(TValue *, slot), val); /* set its new value */
|
||||
luaH_finishset(L, h, key, slot, val); /* set new value */
|
||||
invalidateTMcache(h);
|
||||
luaC_barrierback(L, obj2gco(h), val);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user