"...Lua does not distinguish between stack errors and other errors when calling the closing method, so any error while running it will call it again..." ( http://lua-users.org/lists/lua-l/2020-07/msg00225.html ) defer and <close> should not be used until "called twice" will be fixed. This behaviour is unacceptable. сб, 18 июл. 2020 г. в 02:41, Dibyendu Majumdar <mobile@majumdar.org.uk>: > > Hi, > > I am pleased to announce an initial version of the 'defer' statement > patch of Lua 5.4 is available at > https://github.com/dibyendumajumdar/ravi/blob/master/patches/defer_statement_for_Lua_5_4.patch. > > Thanks and Regards > Dibyendu