开发者

Can I override colon operator in Lua?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜