开发者

Can I override colon operator in Lua?

开发者 https://www.devze.com 2023-03-14 11:44 出处:网络
Lua is using colon operator (:) as instance开发者_运维百科 method calling. Can I override this operator for another purpose?No, you can\'t. There is no such thing as colon operator- it\'s pure syntact

Lua is using colon operator (:) as instance开发者_运维百科 method calling. Can I override this operator for another purpose?


No, you can't. There is no such thing as colon operator- it's pure syntactic sugar.

obj:func() == obj.func(obj)

This does, however, mean that you can override the dot operator used here and the function call operator of the return value.

0

精彩评论

暂无评论...
验证码 换一张
取 消