MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaF_close

Function luaF_close

extlibs/lua/src/lfunc.c:223–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221
222
223int luaF_close (lua_State *L, StkId level, int status) {
224 UpVal *uv;
225 while ((uv = L->openupval) != NULL && uplevel(uv) >= level) {
226 TValue *slot = &uv->u.value; /* new position for value */
227 lua_assert(uplevel(uv) < L->top);
228 if (uv->tbc && status != NOCLOSINGMETH) {
229 /* must run closing method, which may change the stack */
230 ptrdiff_t levelrel = savestack(L, level);
231 status = callclosemth(L, uplevel(uv), status);
232 level = restorestack(L, levelrel);
233 }
234 luaF_unlinkupval(uv);
235 setobj(L, slot, uv->v); /* move value to upvalue slot */
236 uv->v = slot; /* now current value lives here */
237 if (!iswhite(uv))
238 gray2black(uv); /* closed upvalues cannot be gray */
239 luaC_barrier(L, uv, slot);
240 }
241 return status;
242}
243
244
245Proto *luaF_newproto (lua_State *L) {

Callers 9

luaV_executeFunction · 0.85
close_stateFunction · 0.85
luaE_freethreadFunction · 0.85
lua_resetthreadFunction · 0.85
luaD_throwFunction · 0.85
moveresultsFunction · 0.85
recoverFunction · 0.85
luaD_pcallFunction · 0.85
lua_settopFunction · 0.85

Calls 2

callclosemthFunction · 0.85
luaF_unlinkupvalFunction · 0.85

Tested by

no test coverage detected