local s do s=setmetatable({},{__tostring=function()return"\067\111\110\110\101\099\116\105\111\110"end})s.__index=s function s.new(...)local m=setmetatable({},s)return m:constructor(...)or m end function s.constructor(h,s,m)h.signal=s h.Connected=true h._fn=m end function s.Disconnect(s)if not s.Connected then return nil end s.Connected=false if s.signal._handlerListHead==s then s.signal._handlerListHead=s._next else local m=s.signal._handlerListHead while m and m._next~=s do m=m._next end if m then m._next=s._next end end end function s.Destroy(s)s:Disconnect()end end

local Connection
do
	Connection = setmetatable({}, {
		__tostring = function()
			return "Connection"
		end,
	})
	Connection.__index = Connection
	function Connection.new(...)
		local self = setmetatable({}, Connection)
		return self:constructor(...) or self
	end
	function Connection:constructor(signal, fn)
		self.signal = signal
		self.Connected = true
		self._fn = fn
	end
	function Connection:Disconnect()
		if not self.Connected then
			return nil
		end
		self.Connected = false
		if self.signal._handlerListHead == self then
			self.signal._handlerListHead = self._next
		else
			local prev = self.signal._handlerListHead
			while prev and prev._next ~= self do
				prev = prev._next
			end
			if prev then
				prev._next = self._next
			end
		end
	end
	function Connection:Destroy()
		self:Disconnect()
	end
end