I have an OOP infrastructure that has a function to interpolate the properties of a UnionOperation
. Within the function that handles this - foo
- there is an equality check that returns a RBXScriptConnection
connected to a part’s Touched
event firing:
local conn: RBXScriptConnection
if return_conn then
conn = portal.Touched:Connect(function()
print("Fired")
end)
end
if return_conn then
coroutine.yield(conn)
return conn
end
return
To simulate asynchronicity when interpolating, I create and resume a coroutine twice for two separate objects:
local c: thread
c = coroutine.create(module.foo)
local success, conn1: RBXScriptConnection = coroutine.resume(c, true)
local success, conn2: RBXScriptConnection = coroutine.resume(c, true)
print(success, conn1, conn2)
The issue I’m having is that only one connection is returned, ergo my output is:
true nil Connection
… whilst my expected output is:
true Connection Connection
I’m not sure how to yield values from my coroutine each time it is called? Any help would be appreciated!