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

Function newupval

extlibs/lua/src/lfunc.c:65–81  ·  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, int tbc, 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 = s2v(level); /* current value lives in the stack */
70 uv->tbc = tbc;
71 uv->u.open.next = next; /* link it to list of open upvalues */
72 uv->u.open.previous = prev;
73 if (next)
74 next->u.open.previous = &uv->u.open.next;
75 *prev = uv;
76 if (!isintwups(L)) { /* thread not in list of threads with upvalues? */
77 L->twups = G(L)->twups; /* link it to the list */
78 G(L)->twups = L;
79 }
80 return uv;
81}
82
83
84/*

Callers 2

luaF_findupvalFunction · 0.85
trynewtbcupvalFunction · 0.85

Calls 1

luaC_newobjFunction · 0.85

Tested by

no test coverage detected