blob: 95a7c25b523c3c89bca900732cc68bad17382f28 [file] [log] [blame]
Zesstra3085c662025-08-02 18:31:10 +02001NAME
2 await
3
4SYNTAX
5 await(<coroutine>)
6 await(<coroutine>, <value>)
7
8DESCRIPTION
9 The instruction is only allowed in a coroutine and suspends its
10 execution.
11
12 The target coroutine must also be in a suspended state. Its
13 execution will then continue.
14
15 The current coroutine will wait for the execution of the target
16 coroutine to finish with a return statement or end of statement
17 block. It cannot continue its execution until then. Only one
18 coroutine may wait for another. If there is already a coroutine
19 waiting for the target coroutine the instruction will fail.
20
21 Any calls during the waiting period to continue the current
22 coroutine will result in execution of the target coroutine.
23 So the await() call can be seen as a sub-coroutine call.
24
25 The value will be passed into the target coroutine as the result
26 of its yield() instruction that suspended its execution before.
27 If the coroutine had just started, the value will be discarded.
28 If no value was given, 0 will be passed instead.
29
30HISTORY
31 Coroutines were introduced in LDMud 3.6.5.
32
33SEE ALSO
34 coroutines(LPC), async(LPC), yield(LPC), foreach(LPC),
35 call_coroutine(E), this_coroutine(E)