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?
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.
Answer from the docs. It is a feature: a and b were string and hence shared their metatable.