** Create a new upvalue at the given level, and link it to the list of ** open upvalues of 'L' after entry 'prev'. **/
| 63 | ** open upvalues of 'L' after entry 'prev'. |
| 64 | **/ |
| 65 | static 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 | /* |
no test coverage detected