There is a class in C # with a method that accepts "(params objects [] args)", and a Lua script that passes two parameters to this method, but each time a LuaInterface.LuaException: invalid arguments to method exception is LuaInterface.LuaException: invalid arguments to method .

I'm at a dead end, a very important method in the class, I would say the key one. How to force to transfer an array of untyped arguments from Lua to C #?

    2 answers 2

    From the point of view of the framework, params ignored, and the method expects one argument - an array of objects. Perhaps this is the problem. Try to pack the arguments into an array at the Lua level and pass as one argument.


    Here's more on the topic, maybe it will be useful: https://code.google.com/p/luainterface/issues/detail?id=18

      Thank you, @VladD! So I did and just now read the advice :):

       public bool KillFromList(LuaTable ProcNames) { Log.WriteToLog("Попытка завершить группу процессов"); foreach (DictionaryEntry proc in ProcNames) { try { KillAll(proc.Value.ToString()); Log.WriteToLog("Завершен "+proc.Value.ToString()); } catch (Exception e) { Log.WriteToLog("Не удалось завершить "+proc.Value.ToString()+e.Message); return false; } } return true; } 
      • one
        in, reviewed the answer and found an error in the code ... - cyberdream