task.cancel
Cancels a pending executor coroutine.
Syntax
Signature
task.cancel(Thread: thread) -> ()Aliases
This function has no aliases.
Parameters
| Parameter | Type | Description |
|---|---|---|
Thread | thread | Coroutine to inspect or cancel. |
Returns
| Type | Description |
|---|---|
() | None. |
Notes
Raises an error if the coroutine is no longer scheduled by this environment.
Example
Luau
local Thread = task.delay(30, function() print("Later") end)
task.cancel(Thread)