public void Remove(LuaFunction func, LuaTable self) { LuaState state = func.GetLuaState(); LuaDelegate target; if (self != null) { target = state.GetLuaDelegate(func, self); } else { target = state.GetLuaDelegate(func); } Delegate[] ds = _callback1.GetInvocationList(); for (int i = 0; i < ds.Length; i++) { LuaDelegate ld = ds[i].Target as LuaDelegate; if (ld != null && ld.Equals(target)) { _callback1 = (EventCallback1)Delegate.Remove(_callback1, ds[i]); //DelayDispose�Ĵ���������ȫ��ԭ�������Remove������Add����ôDelayDispose����ɾ������ע�͵����ȴ�tolua�Ľ� state.DelayDispose(ld.func); if (ld.self != null) { state.DelayDispose(ld.self); } break; } } }
public void Remove(LuaFunction func, LuaTable self) { LuaState state = func.GetLuaState(); LuaDelegate target; if (self != null) { target = state.GetLuaDelegate(func, self); } else { target = state.GetLuaDelegate(func); } Delegate[] ds = _callback1.GetInvocationList(); for (int i = 0; i < ds.Length; i++) { LuaDelegate ld = ds[i].Target as LuaDelegate; if (ld != null && ld.Equals(target)) { _callback1 = (EventCallback1)Delegate.Remove(_callback1, ds[i]); //DelayDispose will cause problem //state.DelayDispose(ld.func); //if (ld.self != null) // state.DelayDispose(ld.self); break; } } }