luaH_set check shared table

This commit is contained in:
hong
2019-09-21 14:51:49 +08:00
committed by 云风
parent e485aae55b
commit 21b1c449de

View File

@@ -608,7 +608,10 @@ const TValue *luaH_get (Table *t, const TValue *key) {
** barrier and invalidate the TM cache.
*/
TValue *luaH_set (lua_State *L, Table *t, const TValue *key) {
const TValue *p = luaH_get(t, key);
const TValue *p;
if(isshared(t))
luaG_runerror(L,"attempt to change a shared table");
p = luaH_get(t, key);
if (p != luaO_nilobject)
return cast(TValue *, p);
else return luaH_newkey(L, t, key);