diff options
Diffstat (limited to 'manual')
| -rw-r--r-- | manual/manual.of | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/manual/manual.of b/manual/manual.of index 687a5b89..eb4e671d 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
| @@ -864,7 +864,7 @@ Unlike @Lid{coroutine.resume}, | |||
| 864 | the function created by @Lid{coroutine.wrap} | 864 | the function created by @Lid{coroutine.wrap} |
| 865 | propagates any error to the caller. | 865 | propagates any error to the caller. |
| 866 | In this case, | 866 | In this case, |
| 867 | the function also kills the coroutine @seeF{coroutine.kill}. | 867 | the function also closes the coroutine @seeF{coroutine.close}. |
| 868 | 868 | ||
| 869 | As an example of how coroutines work, | 869 | As an example of how coroutines work, |
| 870 | consider the following code: | 870 | consider the following code: |
| @@ -1554,7 +1554,7 @@ Similarly, if a coroutine ends with an error, | |||
| 1554 | it does not unwind its stack, | 1554 | it does not unwind its stack, |
| 1555 | so it does not close any variable. | 1555 | so it does not close any variable. |
| 1556 | You should either use finalizers | 1556 | You should either use finalizers |
| 1557 | or call @Lid{coroutine.kill} to close the variables in these cases. | 1557 | or call @Lid{coroutine.close} to close the variables in these cases. |
| 1558 | However, note that if the coroutine was created | 1558 | However, note that if the coroutine was created |
| 1559 | through @Lid{coroutine.wrap}, | 1559 | through @Lid{coroutine.wrap}, |
| 1560 | then its corresponding function will close all variables | 1560 | then its corresponding function will close all variables |
| @@ -6351,6 +6351,18 @@ which come inside the table @defid{coroutine}. | |||
| 6351 | See @See{coroutine} for a general description of coroutines. | 6351 | See @See{coroutine} for a general description of coroutines. |
| 6352 | 6352 | ||
| 6353 | 6353 | ||
| 6354 | @LibEntry{coroutine.close (co)| | ||
| 6355 | |||
| 6356 | Closes coroutine @id{co}, | ||
| 6357 | that is, | ||
| 6358 | closes all its pending to-be-closed variables | ||
| 6359 | and puts the coroutine in a dead state. | ||
| 6360 | In case of error closing some variable, | ||
| 6361 | returns @false plus the error object; | ||
| 6362 | otherwise returns @true. | ||
| 6363 | |||
| 6364 | } | ||
| 6365 | |||
| 6354 | @LibEntry{coroutine.create (f)| | 6366 | @LibEntry{coroutine.create (f)| |
| 6355 | 6367 | ||
| 6356 | Creates a new coroutine, with body @id{f}. | 6368 | Creates a new coroutine, with body @id{f}. |
| @@ -6370,17 +6382,6 @@ it is not inside a non-yieldable @N{C function}. | |||
| 6370 | 6382 | ||
| 6371 | } | 6383 | } |
| 6372 | 6384 | ||
| 6373 | @LibEntry{coroutine.kill (co)| | ||
| 6374 | |||
| 6375 | Kills coroutine @id{co}, | ||
| 6376 | closing all its pending to-be-closed variables | ||
| 6377 | and putting the coroutine in a dead state. | ||
| 6378 | In case of error closing some variable, | ||
| 6379 | returns @false plus the error object; | ||
| 6380 | otherwise returns @true. | ||
| 6381 | |||
| 6382 | } | ||
| 6383 | |||
| 6384 | @LibEntry{coroutine.resume (co [, val1, @Cdots])| | 6385 | @LibEntry{coroutine.resume (co [, val1, @Cdots])| |
| 6385 | 6386 | ||
| 6386 | Starts or continues the execution of coroutine @id{co}. | 6387 | Starts or continues the execution of coroutine @id{co}. |
| @@ -6433,7 +6434,7 @@ extra arguments to @id{resume}. | |||
| 6433 | The function returns the same values returned by @id{resume}, | 6434 | The function returns the same values returned by @id{resume}, |
| 6434 | except the first boolean. | 6435 | except the first boolean. |
| 6435 | In case of error, | 6436 | In case of error, |
| 6436 | the function kills the coroutine and propagates the error. | 6437 | the function closes the coroutine and propagates the error. |
| 6437 | 6438 | ||
| 6438 | } | 6439 | } |
| 6439 | 6440 | ||
