If I have this construct:
a.key = b
and both a has a metatable attached and b has a metatable attached. Then b's metatable setter will be called to set key to b. Is this a bug of lua 5.3.0?
EDIT: a and b are strings.
Tables and full userdata have individual metatables (although multiple tables and userdata can share their metatables). Values of all other types share one single metatable per type; that is, there is one single metatable for all numbers, one for all strings, etc. By default, a value has no metatable, but the string library sets a metatable for the string type (see §6.4).
Answer from the docs. It is a feature: a and b were string and hence shared their metatable.
a a string if you have a.key = b?a and b are strings from a.key = b.a.key = b, the equivalent of that was done via the C API. I'll revise my question and state that a and b were strings.
aandbare sharing a metatable or you're misinterpreting the arguments in the newindex handler. You need to provide an SSCCE.