Search code examples
c#objectluainterface

Read returning parameters when calling a lua function using LuaInterface


I am trying to handle the parameters returned from lua when I call DoString:

object[] retval = lua.DoString("some_lua_function()");

The luafunction returns nil, true or false as first parameter and a string as second parameter.

What is the best way to receive the parameters as c# bool and string values?

thank you very much!


Solution

  • Try to return the value.

    object[] res = lua.DoString ("return some_lua_function()");
    

    Like this https://github.com/NLua/NLua/blob/master/tests/LuaTests.cs#L473