Add new sharetable

This commit is contained in:
Cloud Wu
2019-04-17 21:30:47 +08:00
committed by 云风
parent 2ceb642b5d
commit 76b166f04a
8 changed files with 392 additions and 3 deletions

View File

@@ -207,6 +207,8 @@ void luaV_finishset (lua_State *L, const TValue *t, TValue *key,
const TValue *tm; /* '__newindex' metamethod */
if (slot != NULL) { /* is 't' a table? */
Table *h = hvalue(t); /* save 't' table */
if (isshared(h))
luaG_typeerror(L, t, "change");
lua_assert(ttisnil(slot)); /* old value must be nil */
tm = fasttm(L, h->metatable, TM_NEWINDEX); /* get metamethod */
if (tm == NULL) { /* no metamethod? */