当我遇到一点问题时,我正在尝试将 Lua 集成到我的 C# 应用程序中。我希望有更多专业知识的人可以帮助我指出正确的方向。
假设我有以下 C# 方法:
public void MyMethod(int foo) { ... }
public void MyMethod(int foo, int bar) { ... }
我想将它注册到我的 Lua 脚本环境中,这样我就可以执行以下操作:
-- call method with one param
MyMethod(123)
-- call method with two params
MyMethod(123, 456)
我尝试了 RegisterFunction("MyMethod", this, this.GetType().GetMethod("MyMethod")) 但它合理地抱怨不明确的匹配。有任何想法吗?