From 409256b7849ec5ab3296cb0ab9eba3d65955d5ea Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 18 Dec 2020 11:22:42 -0300 Subject: 'coroutine.close'/'lua_resetthread' report original errors Besides errors in closing methods, 'coroutine.close' and 'lua_resetthread' also consider the original error that stopped the thread, if any. --- manual/manual.of | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'manual/manual.of') diff --git a/manual/manual.of b/manual/manual.of index 771bace0..164e359a 100644 --- a/manual/manual.of +++ b/manual/manual.of @@ -4098,10 +4098,12 @@ and then pops the top element. Resets a thread, cleaning its call stack and closing all pending to-be-closed variables. Returns a status code: -@Lid{LUA_OK} for no errors in closing methods, +@Lid{LUA_OK} for no errors in the thread +(either the original error that stopped the thread or +errors in closing methods), or an error status otherwise. In case of error, -leaves the error object on the top of the stack, +leaves the error object on the top of the stack. } @@ -6577,7 +6579,9 @@ that is, closes all its pending to-be-closed variables and puts the coroutine in a dead state. The given coroutine must be dead or suspended. -In case of error closing some variable, +In case of error +(either the original error that stopped the coroutine or +errors in closing methods), returns @false plus the error object; otherwise returns @true. -- cgit v1.2.3-55-g6feb