Added Unconnect to connections. Allows fastmode connections to be removed

This commit is contained in:
2022-12-25 21:14:34 -05:00
parent f5e95b8c9f
commit 8c3d66a7b1
3 changed files with 111 additions and 67 deletions
+10 -2
View File
@@ -244,6 +244,14 @@ function multi:newConnection(protect,func,kill)
return call_funcs
end
function c:Unconnect(conn)
if conn.fast then
table.remove(fast,conn.ind)
elseif conn.Destroy then
conn:Destroy()
end
end
function c:fastMode()
if find_optimization then return self end
function self:Fire(...)
@@ -252,8 +260,8 @@ function multi:newConnection(protect,func,kill)
end
end
function self:Connect(func)
table.insert(fast,func)
local temp = {}
table.insert(fast, func)
local temp = {fast = true, ind = #fast}
setmetatable(temp,{
__call=function(s,...)
return self:Connect(...)