lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I am using LuaInterface, I am stuck on how to solve this annoying issue.

In C# code I  am using the RegisterFunction method to bind my lua functions to my C# functions
For example  in C# something like

lua.RegisterFunction("sleep", this, GetType().GetMethod("sleepLua"));

public void sleepLua(int periodInMs)
{ ... }

This all works fine until I write a lua script and make a mistake and pass in the wrong number of arguments to the  function.

For example in Lua if I have by mistake
sleep()   -- forgot to include the sleep period

I get the following error text displayed
"invalid arguments to method call"

This inadequate error message is a real pain for a big source file, as it gives me no clue where the issue is.

Is there a way I can find out the script line number where it hit the error, or maybe the lua file line number where it hit the error ?

Any help would be most appreciated.