在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
http://lua.2524044.n2.nabble.com/LightUserData-and-metatables-td3807698.html https://www.lua.org/manual/5.3/manual.html#2.4 https://www.lua.org/manual/5.0/manual.html#3.8
"... do you realize that by setting the metatable of a light userdata
设置Full UserData的metatable设置的是一个Full UserData实例的metatable。 设置Light UserData的metatable设置的是所有Light UserData实例的metatable。
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). 只有Table和Full UserData有独立的metatable,其他类型的值共享一个metatable。 |
请发表评论