aboutsummaryrefslogtreecommitdiff
path: root/lfunc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-08-16 09:51:54 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-08-16 09:51:54 -0300
commitca13be9af784b7288d3a07d9b5bccb329086e885 (patch)
treec027419f98064d681518a4130439920a13a11b06 /lfunc.c
parenta1d8eb27431c02c4529be1efd92143ad65434f3a (diff)
downloadlua-ca13be9af784b7288d3a07d9b5bccb329086e885.tar.gz
lua-ca13be9af784b7288d3a07d9b5bccb329086e885.tar.bz2
lua-ca13be9af784b7288d3a07d9b5bccb329086e885.zip
Supressed errors in '__close' generate warnings
Diffstat (limited to 'lfunc.c')
-rw-r--r--lfunc.c6
1 files changed, 5 insertions, 1 deletions
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) {
164 int newstatus = luaD_pcall(L, callclose, NULL, oldtop, 0); 164 int newstatus = luaD_pcall(L, callclose, NULL, oldtop, 0);
165 if (newstatus != LUA_OK && status == CLOSEPROTECT) /* first error? */ 165 if (newstatus != LUA_OK && status == CLOSEPROTECT) /* first error? */
166 status = newstatus; /* this will be the new error */ 166 status = newstatus; /* this will be the new error */
167 else /* leave original error (or nil) on top */ 167 else {
168 if (newstatus != LUA_OK) /* supressed error? */
169 luaE_warnerror(L, "__close metamethod");
170 /* leave original error (or nil) on top */
168 L->top = restorestack(L, oldtop); 171 L->top = restorestack(L, oldtop);
172 }
169 } 173 }
170 /* else no metamethod; ignore this case and keep original error */ 174 /* else no metamethod; ignore this case and keep original error */
171 } 175 }