Lua元素

Lua元素,在 Lua 的 table 中我们可以访问对应的 key 来得到 value 值,但是却无法对两个 table 进行操作。

Lua index元方法

Lua index元方法,这是 metatable 最常用的键。当你通过键来访问 table 的时候,如果这个键没有值,那么 Lua 就会寻找该 table 的 metatable(假定有 metatable)中的 `__index` 键。

Lua newindex元方法

Lua newindex元方法,Lua 中的 `__newindex` 元方法用来对表更新,`__index` 则用来对表访问。当你给表的一个缺少的索引赋值,解释器就会查找 `__newindex` 元方法。

Lua表添加操作符

Lua表添加操作符,在 Lua 中我们通过使用元方法,可以为 table 添加操作符。

Lua call元方法

Lua call元方法,在 Lua 中 `__call` 元方法在 Lua 调用一个值时调用。

Lua tostring元方法

Lua tostring元方法,在 Lua 中 `__tostring` 元方法用于修改表的输出行为。