Skip to content

Commit d63a057

Browse files
authored
Fix inaccuracies in spawn and defer descriptions. (#892)
## Changes - Fixes `task.defer` description that stated that it runs the code on the next resumption cycle. This is false. It runs at the end of the _current_ resumption cycle. - Fixes `task.defer` and `task.spawn` inaccuracy that states they do not return anything. They both return a thread object, which is reflected in the return value section of the documentation. Thus, these sentences are removed. ## Checks By submitting your pull request for review, you agree to the following: - [x] This contribution was created in whole or in part by me, and I have the right to submit it under the terms of this repository's open source licenses. - [x] I understand and agree that this contribution and a record of it are public, maintained indefinitely, and may be redistributed under the terms of this repository's open source licenses. - [x] To the best of my knowledge, all proposed changes are accurate. ---------
1 parent eea60cd commit d63a057

File tree

1 file changed

+5
-7
lines changed
  • content/en-us/reference/engine/libraries

1 file changed

+5
-7
lines changed

content/en-us/reference/engine/libraries/task.yaml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ functions:
2020
description: |
2121
Accepts a function or a thread (as returned by coroutine.create) and
2222
calls/resumes it immediately through the engine's scheduler. Arguments
23-
after the first are sent to the function/thread. This function does not
24-
return any value, even if the provided function returns one immediately.
23+
after the first are sent to the function/thread.
2524
2625
This function is based on the fastSpawn pattern rather than being a
2726
replacement for the deprecated global `spawn` function. It is recommended
@@ -52,15 +51,14 @@ functions:
5251
code_samples:
5352
- name: task.defer
5453
summary: |
55-
Calls/resumes a function/coroutine on the next resumption cycle.
54+
Calls/resumes a function/coroutine at the end of the current resumption cycle.
5655
description: |
5756
Accepts a function or a thread (as returned by coroutine.create) and
58-
defers it until the next
59-
[resumption cycle](https://devforum.roblox.com/t/1240569), at which point
57+
defers it until the end of the current
58+
resumption cycle, at which point
6059
it is resumed with the engine's scheduler like with
6160
`Library.task.spawn()`. Arguments after the first are sent to the
62-
function/thread. This function does not return any value, even if the
63-
provided function returns one immediately.
61+
function/thread.
6462
6563
This function should be used when a similar behavior to
6664
`Library.task.spawn()` is desirable, but the thread does not need to run

0 commit comments

Comments
 (0)