|
7 | 7 | * inside the table coroutine.
|
8 | 8 | */
|
9 | 9 | declare namespace coroutine {
|
10 |
| - /** |
11 |
| - * Creates a new coroutine, with body f. f must be a function. Returns this |
12 |
| - * new coroutine, an object with type "thread". |
13 |
| - */ |
14 |
| - function create(f: (...args: any[]) => any): LuaThread; |
| 10 | + /** |
| 11 | + * Creates a new coroutine, with body f. f must be a function. Returns this |
| 12 | + * new coroutine, an object with type "thread". |
| 13 | + */ |
| 14 | + function create(f: (...args: any[]) => any): LuaThread; |
15 | 15 |
|
16 |
| - /** |
17 |
| - * Starts or continues the execution of coroutine co. The first time you |
18 |
| - * resume a coroutine, it starts running its body. The values val1, ... are |
19 |
| - * passed as the arguments to the body function. If the coroutine has yielded, |
20 |
| - * resume restarts it; the values val1, ... are passed as the results from the |
21 |
| - * yield. |
22 |
| - * |
23 |
| - * If the coroutine runs without any errors, resume returns true plus any |
24 |
| - * values passed to yield (when the coroutine yields) or any values returned |
25 |
| - * by the body function (when the coroutine terminates). If there is any |
26 |
| - * error, resume returns false plus the error message. |
27 |
| - * @tupleReturn |
28 |
| - */ |
29 |
| - function resume(co: LuaThread, ...val: any[]): [true, ...any[]] | [false, string]; |
| 16 | + /** |
| 17 | + * Starts or continues the execution of coroutine co. The first time you |
| 18 | + * resume a coroutine, it starts running its body. The values val1, ... are |
| 19 | + * passed as the arguments to the body function. If the coroutine has yielded, |
| 20 | + * resume restarts it; the values val1, ... are passed as the results from the |
| 21 | + * yield. |
| 22 | + * |
| 23 | + * If the coroutine runs without any errors, resume returns true plus any |
| 24 | + * values passed to yield (when the coroutine yields) or any values returned |
| 25 | + * by the body function (when the coroutine terminates). If there is any |
| 26 | + * error, resume returns false plus the error message. |
| 27 | + * @tupleReturn |
| 28 | + */ |
| 29 | + function resume(co: LuaThread, ...val: any[]): [true, ...any[]] | [false, string]; |
30 | 30 |
|
31 |
| - /** |
32 |
| - * Returns the status of coroutine co, as a string: "running", if the |
33 |
| - * coroutine is running (that is, it called status); "suspended", if the |
34 |
| - * coroutine is suspended in a call to yield, or if it has not started running |
35 |
| - * yet; "normal" if the coroutine is active but not running (that is, it has |
36 |
| - * resumed another coroutine); and "dead" if the coroutine has finished its |
37 |
| - * body function, or if it has stopped with an error. |
38 |
| - */ |
39 |
| - function status(co: LuaThread): 'running' | 'suspended' | 'normal' | 'dead'; |
| 31 | + /** |
| 32 | + * Returns the status of coroutine co, as a string: "running", if the |
| 33 | + * coroutine is running (that is, it called status); "suspended", if the |
| 34 | + * coroutine is suspended in a call to yield, or if it has not started running |
| 35 | + * yet; "normal" if the coroutine is active but not running (that is, it has |
| 36 | + * resumed another coroutine); and "dead" if the coroutine has finished its |
| 37 | + * body function, or if it has stopped with an error. |
| 38 | + */ |
| 39 | + function status(co: LuaThread): 'running' | 'suspended' | 'normal' | 'dead'; |
40 | 40 |
|
41 |
| - /** |
42 |
| - * Creates a new coroutine, with body f. f must be a function. Returns a |
43 |
| - * function that resumes the coroutine each time it is called. Any arguments |
44 |
| - * passed to the function behave as the extra arguments to resume. Returns the |
45 |
| - * same values returned by resume, except the first boolean. In case of error, |
46 |
| - * propagates the error. |
47 |
| - */ |
48 |
| - function wrap(f: (...args: any[]) => any): /** @tupleReturn */ (...args: any[]) => any[]; |
| 41 | + /** |
| 42 | + * Creates a new coroutine, with body f. f must be a function. Returns a |
| 43 | + * function that resumes the coroutine each time it is called. Any arguments |
| 44 | + * passed to the function behave as the extra arguments to resume. Returns the |
| 45 | + * same values returned by resume, except the first boolean. In case of error, |
| 46 | + * propagates the error. |
| 47 | + */ |
| 48 | + function wrap(f: (...args: any[]) => any): /** @tupleReturn */ (...args: any[]) => any[]; |
49 | 49 |
|
50 |
| - /** |
51 |
| - * Suspends the execution of the calling coroutine. Any arguments to yield are |
52 |
| - * passed as extra results to resume. |
53 |
| - * @tupleReturn |
54 |
| - */ |
55 |
| - function yield(...args: any[]): any[]; |
| 50 | + /** |
| 51 | + * Suspends the execution of the calling coroutine. Any arguments to yield are |
| 52 | + * passed as extra results to resume. |
| 53 | + * @tupleReturn |
| 54 | + */ |
| 55 | + function yield(...args: any[]): any[]; |
56 | 56 | }
|
0 commit comments