diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-06-12 11:15:09 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-06-12 11:15:09 -0300 |
commit | fd897027f19288ce2cb0249cb8c1818e2f3f1c4c (patch) | |
tree | 7fd131ca204c4100a24157405eda4239d2155a46 /ldo.c | |
parent | d05fe48bfdd89956c0ebd115dca0fb115aa28dd6 (diff) | |
download | lua-fd897027f19288ce2cb0249cb8c1818e2f3f1c4c.tar.gz lua-fd897027f19288ce2cb0249cb8c1818e2f3f1c4c.tar.bz2 lua-fd897027f19288ce2cb0249cb8c1818e2f3f1c4c.zip |
A coroutine can close itself
A call to close itself will close all its to-be-closed variables and
return to the resume that (re)started the coroutine.
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -139,6 +139,16 @@ l_noret luaD_throw (lua_State *L, TStatus errcode) { | |||
139 | } | 139 | } |
140 | 140 | ||
141 | 141 | ||
142 | l_noret luaD_throwbaselevel (lua_State *L, TStatus errcode) { | ||
143 | if (L->errorJmp) { | ||
144 | /* unroll error entries up to the first level */ | ||
145 | while (L->errorJmp->previous != NULL) | ||
146 | L->errorJmp = L->errorJmp->previous; | ||
147 | } | ||
148 | luaD_throw(L, errcode); | ||
149 | } | ||
150 | |||
151 | |||
142 | TStatus luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { | 152 | TStatus luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { |
143 | l_uint32 oldnCcalls = L->nCcalls; | 153 | l_uint32 oldnCcalls = L->nCcalls; |
144 | struct lua_longjmp lj; | 154 | struct lua_longjmp lj; |