/// <summary> /// 执行Lua方法 /// </summary> public static object[] CallMethod(string module, string func, params object[] args) { LuaManager luaMgr = Manager.Get <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); VisowFrameWork.LuaManager obj = (VisowFrameWork.LuaManager)ToLua.CheckObject <VisowFrameWork.LuaManager>(L, 1); 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)); } }