LuaInterface - how to register overloaded methods?

Posted by JeffreySadeli on Stack Overflow See other posts from Stack Overflow or by JeffreySadeli
Published on 2010-05-18T05:00:24Z Indexed on 2010/05/18 5:10 UTC
Read the original article Hit count: 237

Filed under:
|
|
|
|

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?

© Stack Overflow or respective owner

Related posts about c#

Related posts about luainterface