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

如何访问java类的属性呢? #34

Closed
zhouweiwansui opened this issue Apr 30, 2021 · 1 comment
Closed

如何访问java类的属性呢? #34

zhouweiwansui opened this issue Apr 30, 2021 · 1 comment
Labels

Comments

@zhouweiwansui
Copy link

public class TrainRecord {
public String student_id;
}
这个类作为参数传入lua函数里面
这样的属性如何访问?再lua里面用TrainRecord.student_id访问不行

@ichenhe
Copy link
Owner

ichenhe commented Oct 9, 2021

注意 lua 的基本语法。lua 类成员的访问不是直接用 .,而是冒号 :,本质上是一个语法糖。

另外 demo 中也演示了。「注入 java 对象」就是。

@ichenhe ichenhe closed this as completed Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants