From ca13be9af784b7288d3a07d9b5bccb329086e885 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 16 Aug 2019 09:51:54 -0300 Subject: Supressed errors in '__close' generate warnings --- lfunc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lfunc.c') diff --git a/lfunc.c b/lfunc.c index 8f39f6b0..1e61f03f 100644 --- a/lfunc.c +++ b/lfunc.c @@ -164,8 +164,12 @@ static int callclosemth (lua_State *L, StkId level, int status) { int newstatus = luaD_pcall(L, callclose, NULL, oldtop, 0); if (newstatus != LUA_OK && status == CLOSEPROTECT) /* first error? */ status = newstatus; /* this will be the new error */ - else /* leave original error (or nil) on top */ + else { + if (newstatus != LUA_OK) /* supressed error? */ + luaE_warnerror(L, "__close metamethod"); + /* leave original error (or nil) on top */ L->top = restorestack(L, oldtop); + } } /* else no metamethod; ignore this case and keep original error */ } -- cgit v1.2.3-55-g6feb