I have a problem with LuaInterface accessing Lua functions from C#.
If I have a LuaFunction defined like this
function object:OnEvent()
-- Do something
end
this could be access from C# with a normal call like
(object["OnEvent"] as LuaFunction).Call();
without parameters. But if you look at the definition of the function in Lua, I used a ":" to define the function. I could rewrite it like this, which is the same:
function object.OnEvent(self)
-- Do something
end
So far, all is Ok. But now, I replace OnEvent by another function.
function Replacement(self)
-- Do something other
end
object.OnEvent = Replacement
And now I get a problem. In this case, I had to call the function with a parameter (for self). If I didn't do this, I get an error.
I could solve this problem by two things:
- Say LuaInterface, that it should call methods with ":" each time with a parameter for self.
- I could retrive from LuaInterface, how many parameters this function needs.
But, how to do one of this things?
Thank you.