Zesstra | 3085c66 | 2025-08-02 18:31:10 +0200 | [diff] [blame] | 1 | NAME |
| 2 | yield |
| 3 | |
| 4 | SYNTAX |
| 5 | yield() |
| 6 | yield(<value>) |
| 7 | yield(<value>, <coroutine>) |
| 8 | |
| 9 | DESCRIPTION |
| 10 | The instruction is only allowed in a coroutine and suspends its |
| 11 | execution. |
| 12 | |
| 13 | The first two forms return to the caller (i.e. the function that |
| 14 | continued the execution of the coroutine with call_coroutine()), |
| 15 | the third form resumes execution of the given coroutine, which |
| 16 | must currently be in a suspended state. |
| 17 | |
| 18 | The value will be passed to the caller as the result of the |
| 19 | call_coroutine() call resp. to the target coroutine as the result |
| 20 | of its yield() instruction that suspended its execution before. |
| 21 | If the coroutine had just started, the value will be discarded. |
| 22 | In the first form, 0 will be passed to the caller. |
| 23 | |
| 24 | HISTORY |
| 25 | Coroutines were introduced in LDMud 3.6.5. |
| 26 | |
| 27 | SEE ALSO |
| 28 | coroutines(LPC), async(LPC), await(LPC), foreach(LPC), |
| 29 | call_coroutine(E), this_coroutine(E) |