MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / luaF_findupval

Function luaF_findupval

3rd/lua-5.4.3/src/lfunc.c:88–100  ·  view source on GitHub ↗

** Find and reuse, or create if it does not exist, an upvalue ** at the given level. */

Source from the content-addressed store, hash-verified

86** at the given level.
87*/
88UpVal *luaF_findupval (lua_State *L, StkId level) {
89 UpVal **pp = &L->openupval;
90 UpVal *p;
91 lua_assert(isintwups(L) || L->openupval == NULL);
92 while ((p = *pp) != NULL && uplevel(p) >= level) { /* search for it */
93 lua_assert(!isdead(G(L), p));
94 if (uplevel(p) == level) /* corresponding upvalue? */
95 return p; /* return it */
96 pp = &p->u.open.next;
97 }
98 /* not found: create a new upvalue after 'pp' */
99 return newupval(L, 0, level, pp);
100}
101
102
103/*

Callers 1

pushclosureFunction · 0.85

Calls 1

newupvalFunction · 0.85

Tested by

no test coverage detected