Update function-coroutine-close.md

Clarify behavior when calling coroutine.close repeatedly.
This commit is contained in:
Arseny Kapoulkine 2021-11-08 13:08:28 -08:00 committed by GitHub
parent 41f386b1c0
commit e7b50dc41b
Signed by: DevComp
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,7 +22,7 @@ We implement Lua 5.4 behavior exactly with the exception of to-be-closed variabl
The `co` argument must be a coroutine object (of type `thread`). The `co` argument must be a coroutine object (of type `thread`).
After closing the coroutine, it gets transitioned to dead state which means that `coroutine.status` will return `"dead"` and attempts to resume the coroutine will fail. In addition, the coroutine stack (which can be accessed via `debug.traceback` or `debug.info`) will become empty. After closing the coroutine, it gets transitioned to dead state which means that `coroutine.status` will return `"dead"` and attempts to resume the coroutine will fail. In addition, the coroutine stack (which can be accessed via `debug.traceback` or `debug.info`) will become empty. Calling `coroutine.close` on a closed coroutine will return the same information as it returned the first time - that is, `true` if the coroutine was in a non-error state when closed for the first time, and `false` plus the error object otherwise.
## Drawbacks ## Drawbacks