c# - LuaInterface - how to register overloaded methods? -


When I hit a bit, I'm trying to integrate Lua on my C # app. I was hoping someone else could help me in the right direction with specialization.

Assume that I have the following C # method:

  Public Zero MyMethod (int foo) {...} Public Zero MyMethod (int foo, int bar) {...}  

I would like to register it in my LeA script environment so that I can do something like this:

  - An Ultimate MyMethod (123) Call method with two parameters call method with my parameter MyMethod (123, 456)  

I registerfunction ("MyMethod", this, it.getType (). GetMethod ("MyMethod")) But learn about this reasonably ambiguous matching The offers. Any ideas?

You can register the function with different names and then use a pure lua function to dispatch, by checking the penalties The correct method

  function mimethip (foo, bar) if the bar is too short, mymute 1 (fu, bar) and my math 2 (fu) end and  

optional As such, you can enforce and force this proxy function in C #, instead of every surcharge The respect can be forced.


Comments