/// <summary> /// 注册模块 /// </summary> internal static void register(LuaContext context, Type t) { string moduleName = LuaModule.moduleName(t); if (context.isModuleRegisted(moduleName)) { return; } MethodInfo m = t.GetMethod("_register", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy); if (m != null) { m.Invoke(null, new object[] { context, moduleName, t }); } }
/// <summary> /// 注册模块 /// </summary> /// <typeparam name="T">模块类型</typeparam> public void registerModule <T>() where T : LuaModule { LuaModule.register(this, typeof(T)); }