MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / luaF_findupval

Function luaF_findupval

lib/lua/src/lfunc.c:87–99  ·  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

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

Callers 1

pushclosureFunction · 0.85

Calls 2

newupvalFunction · 0.85
GFunction · 0.50

Tested by

no test coverage detected