LuaInterface - how to register overloaded methods?
- by JeffreySadeli
Hello world! I'm trying to integrate Lua to my C# app when I hit a little snag. I was hoping someone with more expertise could help point me to the right direction.
Let's say I have the following C# methods:
public void MyMethod(int foo) { ... }
public void MyMethod(int foo, int bar) { ... }
I would like to register it to my Lua script environment so that I can do something like this:
-- call method with one param
MyMethod(123)
-- call method with two params
MyMethod(123, 456)
I tried RegisterFunction("MyMethod", this, this.GetType().GetMethod("MyMethod")) but it reasonably complains about ambiguous match. Any ideas?