Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix signal:Wait() method when :Fire() is called after :Wait() in a no…
Browse files Browse the repository at this point in the history
…n-suspended coroutine.

Fixes the error "cannot spawn non-suspended coroutine with arguments", as seen in https://www.youtube.com/watch?v=yevAvHU3ewo

The coroutine's status is now checked before spawning it in :Wait().
wclxb authored Jan 18, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 7c7a5ea commit 50ef51a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/signal/init.luau
Original file line number Diff line number Diff line change
@@ -385,7 +385,10 @@ function Signal:Wait()

self:Once(function(...)
yieldedThreads[thread] = nil
task.spawn(thread, ...)

if coroutine.status(thread) == "suspended" then
task.spawn(thread, ...)
end
end)

return coroutine.yield()

0 comments on commit 50ef51a

Please sign in to comment.