Exemple #1
0
        /// <summary>
        /// 执行Lua方法
        /// </summary>
        public static object[] CallMethod(string module, string func, params object[] args)
        {
            LuaManager luaMgr = AppFacade.Instance.GetManager <LuaManager>(ManagerName.Lua);

            if (luaMgr == null)
            {
                return(null);
            }
            return(luaMgr.CallFunction(module + "." + func, args));
        }
 static int CallFunction(IntPtr L)
 {
     try
     {
         int count = LuaDLL.lua_gettop(L);
         MyFrameWork.LuaManager obj = (MyFrameWork.LuaManager)ToLua.CheckObject(L, 1, typeof(MyFrameWork.LuaManager));
         string   arg0 = ToLua.CheckString(L, 2);
         object[] arg1 = ToLua.ToParamsObject(L, 3, count - 2);
         object[] o    = obj.CallFunction(arg0, arg1);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }