LuaInterface.CodeGeneration.GetEvent C# (CSharp) Method

GetEvent() public method

public GetEvent ( Type eventHandlerType, LuaFunction eventHandler ) : LuaInterface.LuaEventHandler
eventHandlerType System.Type
eventHandler LuaFunction
return LuaInterface.LuaEventHandler
        public LuaEventHandler GetEvent(Type eventHandlerType, LuaFunction eventHandler)
        {
            Type eventConsumerType;
            if (eventHandlerCollection.ContainsKey(eventHandlerType))
            {
                eventConsumerType=eventHandlerCollection[eventHandlerType];
            }
            else
            {
                eventConsumerType=GenerateEvent(eventHandlerType);
                eventHandlerCollection[eventHandlerType] = eventConsumerType;
            }
            LuaEventHandler luaEventHandler=(LuaEventHandler)Activator.CreateInstance(eventConsumerType);
            luaEventHandler.handler=eventHandler;
            return luaEventHandler;
        }