mirror of
https://github.com/lua/lua.git
synced 2026-01-27 01:44:31 +00:00
'luaH_fastseti' uses 'checknoTM'
The extra check in checknoTM (versus only checking whether there is a metatable) is cheap, and it is not that uncommon for a table to have a metatable without a __newindex metafield.
This commit is contained in:
parent
25a491fe34
commit
412e9a4d95
2
ltable.h
2
ltable.h
@ -58,7 +58,7 @@
|
||||
{ Table *h = t; lua_Unsigned u = l_castS2U(k) - 1u; \
|
||||
if ((u < h->asize)) { \
|
||||
lu_byte *tag = getArrTag(h, u); \
|
||||
if (h->metatable == NULL || !tagisempty(*tag)) \
|
||||
if (checknoTM(h->metatable, TM_NEWINDEX) || !tagisempty(*tag)) \
|
||||
{ fval2arr(h, u, tag, val); hres = HOK; } \
|
||||
else hres = ~cast_int(u); } \
|
||||
else { hres = luaH_psetint(h, k, val); }}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user