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

Function newupval

lib/lua/src/lfunc.c:65–80  ·  view source on GitHub ↗

** Create a new upvalue at the given level, and link it to the list of ** open upvalues of 'L' after entry 'prev'. **/

Source from the content-addressed store, hash-verified

63** open upvalues of 'L' after entry 'prev'.
64**/
65static UpVal *newupval (lua_State *L, StkId level, UpVal **prev) {
66 GCObject *o = luaC_newobj(L, LUA_VUPVAL, sizeof(UpVal));
67 UpVal *uv = gco2upv(o);
68 UpVal *next = *prev;
69 uv->v.p = s2v(level); /* current value lives in the stack */
70 uv->u.open.next = next; /* link it to list of open upvalues */
71 uv->u.open.previous = prev;
72 if (next)
73 next->u.open.previous = &uv->u.open.next;
74 *prev = uv;
75 if (!isintwups(L)) { /* thread not in list of threads with upvalues? */
76 L->twups = G(L)->twups; /* link it to the list */
77 G(L)->twups = L;
78 }
79 return uv;
80}
81
82
83/*

Callers 1

luaF_findupvalFunction · 0.85

Calls 2

luaC_newobjFunction · 0.85
GFunction · 0.50

Tested by

no test coverage detected