Beispiel #1
0
        public MultiValue call(string func, params object[] args)
        {
            int top = LuaDll.lua_gettop(L);

            MultiValue mv = new MultiValue(args);

            LuaDll.lua_getfield(L, LuaDll.LUA_GLOBALSINDEX, func);
            int count = pushValue(mv);
            int ret   = LuaDll.lua_pcall(L, count, LuaDll.LUA_MULTRET, 0);

            if (ret != 0)
            {
                string err = LuaDll.lua_tostring(L, -1);
                Console.WriteLine("ERROR: " + err);
                LuaDll.lua_pop(L, 1);
            }
            else
            {
                int newtop = LuaDll.lua_gettop(L);
                return(getValues(top + 1, newtop - top));
            }

            return(null);
        }