aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-12-28 11:40:30 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-12-28 11:40:30 -0300
commit7af27ef59da4051914d93d8b63efac663b64765a (patch)
tree73ac919879b442904112dbb972412fc15983d50e /lapi.c
parent0ceada8da92135717d31a3954b5b89a954f9e71a (diff)
downloadlua-7af27ef59da4051914d93d8b63efac663b64765a.tar.gz
lua-7af27ef59da4051914d93d8b63efac663b64765a.tar.bz2
lua-7af27ef59da4051914d93d8b63efac663b64765a.zip
Cleaner handling of errors in '__close' metamethods
Instead of protecting each individual metamethod call, protect the entire call to 'luaF_close'.
Diffstat (limited to '')
-rw-r--r--lapi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lapi.c b/lapi.c
index 03e756d6..00e95a11 100644
--- a/lapi.c
+++ b/lapi.c
@@ -188,7 +188,7 @@ LUA_API void lua_settop (lua_State *L, int idx) {
188 diff = idx + 1; /* will "subtract" index (as it is negative) */ 188 diff = idx + 1; /* will "subtract" index (as it is negative) */
189 } 189 }
190 if (diff < 0 && hastocloseCfunc(ci->nresults)) 190 if (diff < 0 && hastocloseCfunc(ci->nresults))
191 luaF_close(L, L->top + diff, LUA_OK); 191 luaF_close(L, L->top + diff, CLOSEKTOP);
192 L->top += diff; /* correct top only after closing any upvalue */ 192 L->top += diff; /* correct top only after closing any upvalue */
193 lua_unlock(L); 193 lua_unlock(L);
194} 194}