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

大佬求教,关于用lua的方式扩展c#类 #1169

Open
ZLam opened this issue Oct 24, 2024 · 0 comments
Open

大佬求教,关于用lua的方式扩展c#类 #1169

ZLam opened this issue Oct 24, 2024 · 0 comments

Comments

@ZLam
Copy link

ZLam commented Oct 24, 2024

举个例子
c#这边有个叫MyTest命名空间里叫TestClass的类
lua这边有个叫test_class.lua的脚本
我想希望test_class.lua的脚本逻辑扩展到TestClass类里
大概就是local obj = CS.MyTest.TestClass()后,obj:CSharpFunc()当然能调到自己类的方法,也希望能obj:lua_func()调到test_class.lua脚本那边写好的逻辑
我看了下源码,大概是知道每个导出的C#类是有自己对应的元表的,这问题应该是可以通过处理这元表解决,但我用了些比较奇怪的方式找到那元表 =_=
想问问大佬们,要解决这问题一般要怎么做呢,或者官方,xlua本来有接口能处理这问题么。

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

1 participant