mirror of
https://github.com/lua/lua
synced 2026-09-27 00:28:25 +03:00
Supressed errors in '__close' generate warnings
This commit is contained in:
parent
a1d8eb2743
commit
ca13be9af7
10 changed files with 166 additions and 45 deletions
6
lfunc.c
6
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 */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue