Concat conns now properly transfer events
This commit is contained in:
parent
cf980951a4
commit
0bccc0dd87
23
init.lua
23
init.lua
@ -156,11 +156,13 @@ function multi:newConnection(protect,func,kill)
|
|||||||
obj2:Fire(...)
|
obj2:Fire(...)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
cn.__connectionAdded = function(conn, func)
|
||||||
|
cn:Unconnect(conn)
|
||||||
|
obj2:Connect(func)
|
||||||
|
end
|
||||||
elseif type(obj1) == "table" and type(obj2) == "function" then
|
elseif type(obj1) == "table" and type(obj2) == "function" then
|
||||||
ref = cn(function(...)
|
ref = cn(function(...)
|
||||||
print("Fire")
|
|
||||||
obj1:Fire(...)
|
obj1:Fire(...)
|
||||||
print("call")
|
|
||||||
obj2(...)
|
obj2(...)
|
||||||
end)
|
end)
|
||||||
cn.__connectionAdded = function()
|
cn.__connectionAdded = function()
|
||||||
@ -325,7 +327,7 @@ function multi:newConnection(protect,func,kill)
|
|||||||
if self.rawadd then
|
if self.rawadd then
|
||||||
self.rawadd = false
|
self.rawadd = false
|
||||||
else
|
else
|
||||||
self.__connectionAdded(temp)
|
self.__connectionAdded(temp, func)
|
||||||
end
|
end
|
||||||
return temp
|
return temp
|
||||||
end
|
end
|
||||||
@ -418,12 +420,13 @@ function multi:newConnection(protect,func,kill)
|
|||||||
if #funcs>1 then
|
if #funcs>1 then
|
||||||
local ret = {}
|
local ret = {}
|
||||||
for i = 1, #funcs do
|
for i = 1, #funcs do
|
||||||
table.insert(ret, conn_helper(self, funcs[i]))
|
local temp = conn_helper(self, funcs[i])
|
||||||
end
|
table.insert(ret, temp)
|
||||||
if self.rawadd then
|
if self.rawadd then
|
||||||
self.rawadd = false
|
self.rawadd = false
|
||||||
else
|
else
|
||||||
self.__connectionAdded(ret)
|
self.__connectionAdded(temp, funcs[i])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
else
|
else
|
||||||
@ -431,7 +434,7 @@ function multi:newConnection(protect,func,kill)
|
|||||||
if self.rawadd then
|
if self.rawadd then
|
||||||
self.rawadd = false
|
self.rawadd = false
|
||||||
else
|
else
|
||||||
self.__connectionAdded(conn)
|
self.__connectionAdded(conn, tab[1])
|
||||||
end
|
end
|
||||||
return conn
|
return conn
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user