#if USE_UNI_LUA using LuaAPI = UniLua.Lua; using RealStatePtr = UniLua.ILuaState; using LuaCSFunction = UniLua.CSharpFunctionDelegate; #else using LuaAPI = XLua.LuaDLL.Lua; using RealStatePtr = System.IntPtr; using LuaCSFunction = XLua.LuaDLL.lua_CSFunction; #endif using XLua; using System.Collections.Generic; namespace XLua.CSObjectWrap { using Utils = XLua.Utils; public class BFSocketChannelWrap { public static void __Register(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(BF.SocketChannel); Utils.BeginObjectRegister(type, L, translator, 0, 19, 9, 2); Utils.RegisterFunc(L, Utils.METHOD_IDX, "ConnectWithIp", _m_ConnectWithIp); Utils.RegisterFunc(L, Utils.METHOD_IDX, "ConnectWithDomainName", _m_ConnectWithDomainName); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Connect", _m_Connect); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Send", _m_Send); Utils.RegisterFunc(L, Utils.METHOD_IDX, "SendRaw", _m_SendRaw); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Update", _m_Update); Utils.RegisterFunc(L, Utils.METHOD_IDX, "ProcessSend", _m_ProcessSend); Utils.RegisterFunc(L, Utils.METHOD_IDX, "ProcessReceive", _m_ProcessReceive); Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddLuaOnConnectedListener", _m_AddLuaOnConnectedListener); Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddLuaOnDisconnectListener", _m_AddLuaOnDisconnectListener); Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddLuaOnReceiveListener", _m_AddLuaOnReceiveListener); Utils.RegisterFunc(L, Utils.METHOD_IDX, "ClearLuaOnReceiveListener", _m_ClearLuaOnReceiveListener); Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddLuaOnErrorListener", _m_AddLuaOnErrorListener); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Close", _m_Close); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Shutdown", _m_Shutdown); Utils.RegisterFunc(L, Utils.METHOD_IDX, "OnConnected", _e_OnConnected); Utils.RegisterFunc(L, Utils.METHOD_IDX, "OnDisconnected", _e_OnDisconnected); Utils.RegisterFunc(L, Utils.METHOD_IDX, "OnReceive", _e_OnReceive); Utils.RegisterFunc(L, Utils.METHOD_IDX, "OnError", _e_OnError); Utils.RegisterFunc(L, Utils.GETTER_IDX, "Name", _g_get_Name); Utils.RegisterFunc(L, Utils.GETTER_IDX, "ProcessReceiveCountPerFrame", _g_get_ProcessReceiveCountPerFrame); Utils.RegisterFunc(L, Utils.GETTER_IDX, "ConnectIP", _g_get_ConnectIP); Utils.RegisterFunc(L, Utils.GETTER_IDX, "Socket", _g_get_Socket); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsConnected", _g_get_IsConnected); Utils.RegisterFunc(L, Utils.GETTER_IDX, "NetType", _g_get_NetType); Utils.RegisterFunc(L, Utils.GETTER_IDX, "HeartBeatInterval", _g_get_HeartBeatInterval); Utils.RegisterFunc(L, Utils.GETTER_IDX, "HeartBeatWaitSeconds", _g_get_HeartBeatWaitSeconds); Utils.RegisterFunc(L, Utils.GETTER_IDX, "HeartBeatMissCount", _g_get_HeartBeatMissCount); Utils.RegisterFunc(L, Utils.SETTER_IDX, "ProcessReceiveCountPerFrame", _s_set_ProcessReceiveCountPerFrame); Utils.RegisterFunc(L, Utils.SETTER_IDX, "HeartBeatInterval", _s_set_HeartBeatInterval); Utils.EndObjectRegister(type, L, translator, null, null, null, null, null); Utils.BeginClassRegister(type, L, __CreateInstance, 2, 0, 0); Utils.RegisterFunc(L, Utils.CLS_IDX, "GetRandomString", _m_GetRandomString_xlua_st_); Utils.EndClassRegister(type, L, translator); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if(LuaAPI.lua_gettop(L) == 3 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && translator.Assignable(L, 3)) { string _name = LuaAPI.lua_tostring(L, 2); BF.ISocketChannelHelper _channelHelper = (BF.ISocketChannelHelper)translator.GetObject(L, 3, typeof(BF.ISocketChannelHelper)); var gen_ret = new BF.SocketChannel(_name, _channelHelper); translator.Push(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to BF.SocketChannel constructor!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_ConnectWithIp(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); { string _ip = LuaAPI.lua_tostring(L, 2); int _port = LuaAPI.xlua_tointeger(L, 3); gen_to_be_invoked.ConnectWithIp( _ip, _port ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_ConnectWithDomainName(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); { string _domainName = LuaAPI.lua_tostring(L, 2); int _port = LuaAPI.xlua_tointeger(L, 3); gen_to_be_invoked.ConnectWithDomainName( _domainName, _port ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Connect(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); { System.Net.IPAddress _ipAddress = (System.Net.IPAddress)translator.GetObject(L, 2, typeof(System.Net.IPAddress)); int _port = LuaAPI.xlua_tointeger(L, 3); gen_to_be_invoked.Connect( _ipAddress, _port ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Send(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 1) { gen_to_be_invoked.Send( ); return 0; } if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4)) { byte[] _bytes = LuaAPI.lua_tobytes(L, 2); uint _group = LuaAPI.xlua_touint(L, 3); byte _cmd = (byte)LuaAPI.xlua_tointeger(L, 4); gen_to_be_invoked.Send( _bytes, _group, _cmd ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to BF.SocketChannel.Send!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_SendRaw(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); { byte[] _bytes = LuaAPI.lua_tobytes(L, 2); byte _group = (byte)LuaAPI.xlua_tointeger(L, 3); byte _cmd = (byte)LuaAPI.xlua_tointeger(L, 4); gen_to_be_invoked.SendRaw( _bytes, _group, _cmd ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Update(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); { float _elapseSeconds = (float)LuaAPI.lua_tonumber(L, 2); float _realElapseSeconds = (float)LuaAPI.lua_tonumber(L, 3); gen_to_be_invoked.Update( _elapseSeconds, _realElapseSeconds ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_ProcessSend(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.ProcessSend( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_ProcessReceive(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.ProcessReceive( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_AddLuaOnConnectedListener(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); { System.Action _luaFunc = translator.GetDelegate(L, 2); gen_to_be_invoked.AddLuaOnConnectedListener( _luaFunc ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_AddLuaOnDisconnectListener(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); { System.Action _luaFunc = translator.GetDelegate(L, 2); gen_to_be_invoked.AddLuaOnDisconnectListener( _luaFunc ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_AddLuaOnReceiveListener(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); { System.Action _luaFunc = translator.GetDelegate>(L, 2); gen_to_be_invoked.AddLuaOnReceiveListener( _luaFunc ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_ClearLuaOnReceiveListener(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.ClearLuaOnReceiveListener( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_AddLuaOnErrorListener(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); { System.Action _luaFunc = translator.GetDelegate>(L, 2); gen_to_be_invoked.AddLuaOnErrorListener( _luaFunc ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Close(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.Close( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Shutdown(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.Shutdown( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetRandomString_xlua_st_(RealStatePtr L) { try { { int _len = LuaAPI.xlua_tointeger(L, 1); var gen_ret = BF.SocketChannel.GetRandomString( _len ); LuaAPI.lua_pushstring(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_Name(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushstring(L, gen_to_be_invoked.Name); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_ProcessReceiveCountPerFrame(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.ProcessReceiveCountPerFrame); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_ConnectIP(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushstring(L, gen_to_be_invoked.ConnectIP); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_Socket(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.Socket); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsConnected(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsConnected); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_NetType(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.NetType); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_HeartBeatInterval(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushnumber(L, gen_to_be_invoked.HeartBeatInterval); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_HeartBeatWaitSeconds(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushnumber(L, gen_to_be_invoked.HeartBeatWaitSeconds); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_HeartBeatMissCount(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.HeartBeatMissCount); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_ProcessReceiveCountPerFrame(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); gen_to_be_invoked.ProcessReceiveCountPerFrame = LuaAPI.xlua_tointeger(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_HeartBeatInterval(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); gen_to_be_invoked.HeartBeatInterval = (float)LuaAPI.lua_tonumber(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _e_OnConnected(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); System.Action gen_delegate = translator.GetDelegate(L, 3); if (gen_delegate == null) { return LuaAPI.luaL_error(L, "#3 need System.Action!"); } if (gen_param_count == 3) { if (LuaAPI.xlua_is_eq_str(L, 2, "+")) { gen_to_be_invoked.OnConnected += gen_delegate; return 0; } if (LuaAPI.xlua_is_eq_str(L, 2, "-")) { gen_to_be_invoked.OnConnected -= gen_delegate; return 0; } } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } LuaAPI.luaL_error(L, "invalid arguments to BF.SocketChannel.OnConnected!"); return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _e_OnDisconnected(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); System.Action gen_delegate = translator.GetDelegate(L, 3); if (gen_delegate == null) { return LuaAPI.luaL_error(L, "#3 need System.Action!"); } if (gen_param_count == 3) { if (LuaAPI.xlua_is_eq_str(L, 2, "+")) { gen_to_be_invoked.OnDisconnected += gen_delegate; return 0; } if (LuaAPI.xlua_is_eq_str(L, 2, "-")) { gen_to_be_invoked.OnDisconnected -= gen_delegate; return 0; } } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } LuaAPI.luaL_error(L, "invalid arguments to BF.SocketChannel.OnDisconnected!"); return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _e_OnReceive(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); System.Action gen_delegate = translator.GetDelegate>(L, 3); if (gen_delegate == null) { return LuaAPI.luaL_error(L, "#3 need System.Action!"); } if (gen_param_count == 3) { if (LuaAPI.xlua_is_eq_str(L, 2, "+")) { gen_to_be_invoked.OnReceive += gen_delegate; return 0; } if (LuaAPI.xlua_is_eq_str(L, 2, "-")) { gen_to_be_invoked.OnReceive -= gen_delegate; return 0; } } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } LuaAPI.luaL_error(L, "invalid arguments to BF.SocketChannel.OnReceive!"); return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _e_OnError(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); BF.SocketChannel gen_to_be_invoked = (BF.SocketChannel)translator.FastGetCSObj(L, 1); System.Action gen_delegate = translator.GetDelegate>(L, 3); if (gen_delegate == null) { return LuaAPI.luaL_error(L, "#3 need System.Action!"); } if (gen_param_count == 3) { if (LuaAPI.xlua_is_eq_str(L, 2, "+")) { gen_to_be_invoked.OnError += gen_delegate; return 0; } if (LuaAPI.xlua_is_eq_str(L, 2, "-")) { gen_to_be_invoked.OnError -= gen_delegate; return 0; } } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } LuaAPI.luaL_error(L, "invalid arguments to BF.SocketChannel.OnError!"); return 0; } } }