Пример #1
0
        public static LuaModule CreateModule(Table instance, LuaHelper luaHelper)
        {
            if (instance == null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            if (luaHelper == null)
            {
                throw new ArgumentNullException(nameof(luaHelper));
            }

            return(ObjectFactory.GetActivator <LuaModule>(
                       typeof(LuaModule).GetConstructors().First())(instance, luaHelper));
        }
Пример #2
0
        public static ClassWrapper <ILuaPacket> CreatePacket(string interfaceName, Table table, LuaHelper luaHelper)
        {
            if (string.IsNullOrEmpty(interfaceName))
            {
                throw new ArgumentNullException(nameof(interfaceName));
            }

            if (table == null)
            {
                throw new ArgumentNullException(nameof(table));
            }

            if (luaHelper == null)
            {
                throw new ArgumentNullException(nameof(luaHelper));
            }

            var luaPacket = ObjectFactory.GetActivator <ILuaPacket>(
                typeof(LuaPacket).GetConstructors().First())(interfaceName, table, luaHelper);

            return(new ClassWrapper <ILuaPacket>(luaPacket));
        }
Пример #3
0
        public static ClassWrapper <LuaControllerComponent> CreateControllerComponent(Table instance, LuaHelper luaHelper)
        {
            if (instance == null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            if (luaHelper == null)
            {
                throw new ArgumentNullException(nameof(luaHelper));
            }

            var luaRpcComponent = ObjectFactory.GetActivator <LuaControllerComponent>(
                typeof(LuaControllerComponent).GetConstructors().First())(instance, luaHelper);

            return(new ClassWrapper <LuaControllerComponent>(luaRpcComponent));
        }
Пример #4
0
 static LuaUtils()
 {
     LuaHelper.RegisterType <Assembly>();
 }