From c220b0a5d099372e58e517b9f13eaa7bb0bec45c Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 16 Jul 2019 15:17:47 -0300 Subject: '__close' method may be called again in case of error An error in a closing method may be caused by a lack of resources, such as memory or stack space, and the error may free enough resources (by unwinding the stack) to allow the method to work if called again. If the closing method is already running after some error (including its own), it is not called again. --- manual/manual.of | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'manual/manual.of') diff --git a/manual/manual.of b/manual/manual.of index 61fcdaa3..3d2fb4fb 100644 --- a/manual/manual.of +++ b/manual/manual.of @@ -1548,14 +1548,15 @@ they are closed in the reverse order that they were declared. If there is any error while running a closing method, that error is handled like an error in the regular code -where the variable was defined; -in particular, -the other pending closing methods will still be called. +where the variable was defined. +However, Lua may call the method one more time. + After an error, -other errors in closing methods +the other pending closing methods will still be called. +Errors in these methods interrupt the respective method, but are otherwise ignored; -the error reported is the original one. +the error reported is only the original one. If a coroutine yields and is never resumed again, some variables may never go out of scope, -- cgit v1.2.3-55-g6feb