The functions setmetatable() and getmetatable() modify and query an object's metatable, respectively.
函数 setmetatable()和getmetatable() 分别对对象的元表进行修改和查询。
The keys of the metatable are called events; the values (in other words, the functions) are called metamethods.
元表的键值称为事件;值(换而言之就是函数)称为元方法。
The function String() takes a string, string, wraps it in a table ({value = s or ''}), and assigns the metatable mt to the table.
函数String()接收一个字符串 string,将其封装到一个表({value =sor ''})中,并将元表 mt赋值给这个表。
The function String() takes a string, string, wraps it in a table ({value = s or ''}), and assigns the metatable mt to the table.
函数String()接收一个字符串 string,将其封装到一个表({value =sor ''})中,并将元表 mt赋值给这个表。
应用推荐