- What do you want to achieve? Keep it simple and clear!
Basically ive been experimenting with creating custom events. I wanted to implement “:Wait()” to my code but i didnt know how. So i searched for anything useful and found this article(Lua Signal Class Comparison & Optimal `GoodSignal` Class) from Stravant
- What is the issue? Include screenshots / videos if possible!
I noticed that he uses something like this to implement a Wait to his signal module:
function Signal:Wait()
local Cor = coroutine.running()
local Con = nil
Con = self:Connect(function(...)
Con:Disconnect()
task.spawn(Cor,...)
end)
return coroutine.yield()
end
Im a bit confused on what the “coroutine.running()” does. Does it need a coroutine as the parameter. And how does it yield the coroutine even though i dont have any coroutines in my code?
The developer hub wasnt such a big help either
Any help is really appreciated because im a bit confused here on how it works? when i dont have any coroutines in my code
All i ever use is a task.spawn to fire the “Signal:Fire()” method in my code