Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

映射的Object-c类的方法,: 冒号调用成功,而不能直接用 . 逗号调用呢? #35

Open
hushilin opened this issue Oct 27, 2021 · 3 comments

Comments

@hushilin
Copy link

如题:映射的Object-c类的方法,在 lua脚本里 : 冒号可以调用成功,而不能直接用 . 逗号调用呢?

@hushilin
Copy link
Author

映射的时候,我觉得可以细分一下。原生方法有返回值时,可以使用冒号调用,如果无返回值方法,可以直接 逗号 调用

@liuniuliuniu
Copy link

为啥类方法要使用逗号调用呢,这不是很奇怪么,类方法在OC中的使用习惯也不会有逗号调用呀;除非是swift

@vimfung
Copy link
Owner

vimfung commented Apr 6, 2022

如果只考虑OC的话,确实可以按照它的语法来做,但是要在多种语言下通用,我是借鉴了JS里面的语法特点实现的。至于用冒号和点来访问的问题,我记得已经舍弃用冒号调用的方式了,类方法调用是:类名称.方法(),实例对象的方法调用是:实例对象.方法()。具体的因为项目我太久碰过了,有点忘。。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants