-
Notifications
You must be signed in to change notification settings - Fork 593
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
如何导出类的静态成员变量 #22
Comments
UGameplayStatics这种Bp library里面应该都是static函数,可以参考吧 |
是希望导出一个类的静态【变量】到lua哈。 |
@Junho2009 确实是没有这个功能,之后补上吧 |
不好意思,之前把静态变量看成了静态函数 |
@Junho2009 UnLua对类的非静态变量导出后是以lightuserdata形式存在,通过类元表的__index函数再配合类实例的地址和偏移来对它进行读写。静态变量可以通过类直接访问,在lua里就是通过类元表直接访问,这个在UnLua里不好实现(因为直接就返回lightuserdata了),当然通过类的实例可以正常访问,不过这就少了静态变量的特色了。 |
目前似乎没找到对应的宏。
从实现的方面,可以定义一个对应的静态函数来返回,然后导出这个静态函数,不过这样比较繁琐呢。
The text was updated successfully, but these errors were encountered: