| 元方法 | 事件 | 说明 |
|---|---|---|
table[key] |
__index |
根据索引访问表(已存在的键不受影响) |
table[key]=value |
__nexindex |
对表索引更新(已存在的键不受影响) |
func(args) |
__call |
调用同名函数 |
print(table) |
__tostring |
自定义对象转字符串函数 |
+ |
__add |
加 |
- |
__sub |
减 |
* |
__mul |
乘 |
/ |
__div |
除 |
% |
__mod |
取余 |
^ |
__pow |
次方 |
- |
__unm |
取负 |
// |
__idiv |
向下取整除法 |
& |
__band |
按位与 |
| ` | ` | __bor |
~ |
__bxor |
按位异或 |
~ |
__bnot |
按位非 |
<< |
__shl |
左移 |
>> |
__shr |
右移 |
.. |
__concat |
连接 |
# |
__len |
取长度 |
== |
__eq |
等于 |
< |
__lt |
小于 |
<= |
__le |
小于等于 |