aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-01-13 13:54:10 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-01-13 13:54:10 -0300
commitb07fc10e91a5954254b47280aba287220c734a4b (patch)
treee50d4e5ef9aab68487caf0944e72a7de04bb8bb5 /lapi.c
parentcc1692515e2a6aabc6d07159e7926656e38eda53 (diff)
downloadlua-b07fc10e91a5954254b47280aba287220c734a4b.tar.gz
lua-b07fc10e91a5954254b47280aba287220c734a4b.tar.bz2
lua-b07fc10e91a5954254b47280aba287220c734a4b.zip
Allow yields inside '__close' metamethods
Initial implementation to allow yields inside '__close' metamethods. This current version still does not allow a '__close' metamethod to yield when called due to an error. '__close' metamethods from C functions also are not allowed to yield.
Diffstat (limited to '')
-rw-r--r--lapi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lapi.c b/lapi.c
index 0f0e31af..3583e9c0 100644
--- a/lapi.c
+++ b/lapi.c
@@ -189,7 +189,7 @@ LUA_API void lua_settop (lua_State *L, int idx) {
189 } 189 }
190#if defined(LUA_COMPAT_5_4_0) 190#if defined(LUA_COMPAT_5_4_0)
191 if (diff < 0 && hastocloseCfunc(ci->nresults)) 191 if (diff < 0 && hastocloseCfunc(ci->nresults))
192 luaF_close(L, L->top + diff, CLOSEKTOP); 192 luaF_close(L, L->top + diff, CLOSEKTOP, 0);
193#endif 193#endif
194 L->top += diff; 194 L->top += diff;
195 api_check(L, L->openupval == NULL || uplevel(L->openupval) < L->top, 195 api_check(L, L->openupval == NULL || uplevel(L->openupval) < L->top,
@@ -205,7 +205,7 @@ LUA_API void lua_closeslot (lua_State *L, int idx) {
205 api_check(L, hastocloseCfunc(L->ci->nresults) && L->openupval != NULL && 205 api_check(L, hastocloseCfunc(L->ci->nresults) && L->openupval != NULL &&
206 uplevel(L->openupval) == level, 206 uplevel(L->openupval) == level,
207 "no variable to close at given level"); 207 "no variable to close at given level");
208 luaF_close(L, level, CLOSEKTOP); 208 luaF_close(L, level, CLOSEKTOP, 0);
209 setnilvalue(s2v(level)); 209 setnilvalue(s2v(level));
210 lua_unlock(L); 210 lua_unlock(L);
211} 211}