Skip to content

Commit

Permalink
b34a97a4af5c9e973915c07dba918d95009e0acd
Browse files Browse the repository at this point in the history
  • Loading branch information
Sainan committed Feb 25, 2024
1 parent c1bacb1 commit f87aa2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ltable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ static int rawfinishnodeset (const TValue *slot, TValue *val) {
int luaH_psetint (Table *t, lua_Integer key, TValue *val) {
if (keyinarray(t, key)) {
lu_byte *tag = getArrTag(t, key - 1);
if (!tagisempty(*tag)) {
if (!tagisempty(*tag) || checknoTM(t->metatable, TM_NEWINDEX)) {
fval2arr(t, key, tag, val);
return HOK; /* success */
}
Expand Down
7 changes: 4 additions & 3 deletions src/ltm.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ static const char *const luaT_eventname[] = { /* ORDER TM */
*/
#define notm(tm) ttisnil(tm)

#define checknoTM(mt,e) ((mt) == NULL || (mt)->flags & (1u<<(e)))

#define gfasttm(g,et,e) ((et) == NULL ? NULL : \
((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))
#define gfasttm(g,mt,e) \
(checknoTM(mt, e) ? NULL : luaT_gettm(mt, e, (g)->tmname[e]))

#define fasttm(l,et,e) gfasttm(G(l), et, e)
#define fasttm(l,mt,e) gfasttm(G(l), mt, e)

#define ttypename(x) luaT_typenames_[(x) + 1]

Expand Down

0 comments on commit f87aa2f

Please sign in to comment.