MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / aux_upvalue

Function aux_upvalue

third-party/lua-5.5.0/src/lapi.c:1367–1391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1365
1366
1367static const char *aux_upvalue (TValue *fi, int n, TValue **val,
1368 GCObject **owner) {
1369 switch (ttypetag(fi)) {
1370 case LUA_VCCL: { /* C closure */
1371 CClosure *f = clCvalue(fi);
1372 if (!(cast_uint(n) - 1u < cast_uint(f->nupvalues)))
1373 return NULL; /* 'n' not in [1, f->nupvalues] */
1374 *val = &f->upvalue[n-1];
1375 if (owner) *owner = obj2gco(f);
1376 return "";
1377 }
1378 case LUA_VLCL: { /* Lua closure */
1379 LClosure *f = clLvalue(fi);
1380 TString *name;
1381 Proto *p = f->p;
1382 if (!(cast_uint(n) - 1u < cast_uint(p->sizeupvalues)))
1383 return NULL; /* 'n' not in [1, p->sizeupvalues] */
1384 *val = f->upvals[n-1]->v.p;
1385 if (owner) *owner = obj2gco(f->upvals[n - 1]);
1386 name = p->upvalues[n-1].name;
1387 return (name == NULL) ? "(no name)" : getstr(name);
1388 }
1389 default: return NULL; /* not a closure */
1390 }
1391}
1392
1393
1394LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) {

Callers 2

lua_getupvalueFunction · 0.70
lua_setupvalueFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected