//this source code was auto-generated by tolua#, do not modify it
using System;
using LuaInterface;

public class EventDispatcherWrap
{
	public static void Register(LuaState L)
	{
		L.BeginClass(typeof(EventDispatcher), typeof(System.Object));
		L.RegFunction("Regist", Regist);
		L.RegFunction("UnRegist", UnRegist);
		L.RegFunction("DispatchEvent", DispatchEvent);
		L.RegFunction("ClearEvents", ClearEvents);
		L.RegFunction("New", _CreateEventDispatcher);
		L.RegFunction("__tostring", ToLua.op_ToString);
		L.RegVar("instance", get_instance, null);
		L.EndClass();
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int _CreateEventDispatcher(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);

			if (count == 0)
			{
				EventDispatcher obj = new EventDispatcher();
				ToLua.PushObject(L, obj);
				return 1;
			}
			else
			{
				return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: EventDispatcher.New");
			}
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int Regist(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 3);
			EventDispatcher obj = (EventDispatcher)ToLua.CheckObject(L, 1, typeof(EventDispatcher));
			string arg0 = ToLua.CheckString(L, 2);
			MyEventHandler arg1 = null;
			LuaTypes funcType3 = LuaDLL.lua_type(L, 3);

			if (funcType3 != LuaTypes.LUA_TFUNCTION)
			{
				 arg1 = (MyEventHandler)ToLua.CheckObject(L, 3, typeof(MyEventHandler));
			}
			else
			{
				LuaFunction func = ToLua.ToLuaFunction(L, 3);
				arg1 = DelegateFactory.CreateDelegate(typeof(MyEventHandler), func) as MyEventHandler;
			}

			obj.Regist(arg0, arg1);
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int UnRegist(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 3);
			EventDispatcher obj = (EventDispatcher)ToLua.CheckObject(L, 1, typeof(EventDispatcher));
			string arg0 = ToLua.CheckString(L, 2);
			MyEventHandler arg1 = null;
			LuaTypes funcType3 = LuaDLL.lua_type(L, 3);

			if (funcType3 != LuaTypes.LUA_TFUNCTION)
			{
				 arg1 = (MyEventHandler)ToLua.CheckObject(L, 3, typeof(MyEventHandler));
			}
			else
			{
				LuaFunction func = ToLua.ToLuaFunction(L, 3);
				arg1 = DelegateFactory.CreateDelegate(typeof(MyEventHandler), func) as MyEventHandler;
			}

			obj.UnRegist(arg0, arg1);
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int DispatchEvent(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);
			EventDispatcher obj = (EventDispatcher)ToLua.CheckObject(L, 1, typeof(EventDispatcher));
			string arg0 = ToLua.CheckString(L, 2);
			object[] arg1 = ToLua.ToParamsObject(L, 3, count - 2);
			obj.DispatchEvent(arg0, arg1);
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int ClearEvents(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 2);
			EventDispatcher obj = (EventDispatcher)ToLua.CheckObject(L, 1, typeof(EventDispatcher));
			string arg0 = ToLua.CheckString(L, 2);
			obj.ClearEvents(arg0);
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_instance(IntPtr L)
	{
		try
		{
			ToLua.PushObject(L, EventDispatcher.instance);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
}

