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

Function aux_upvalue

third-party/lua-5.2.4/src/lapi.c:1188–1210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1186
1187
1188static const char *aux_upvalue (StkId fi, int n, TValue **val,
1189 GCObject **owner) {
1190 switch (ttype(fi)) {
1191 case LUA_TCCL: { /* C closure */
1192 CClosure *f = clCvalue(fi);
1193 if (!(1 <= n && n <= f->nupvalues)) return NULL;
1194 *val = &f->upvalue[n-1];
1195 if (owner) *owner = obj2gco(f);
1196 return "";
1197 }
1198 case LUA_TLCL: { /* Lua closure */
1199 LClosure *f = clLvalue(fi);
1200 TString *name;
1201 Proto *p = f->p;
1202 if (!(1 <= n && n <= p->sizeupvalues)) return NULL;
1203 *val = f->upvals[n-1]->v;
1204 if (owner) *owner = obj2gco(f->upvals[n - 1]);
1205 name = p->upvalues[n-1].name;
1206 return (name == NULL) ? "" : getstr(name);
1207 }
1208 default: return NULL; /* not a closure */
1209 }
1210}
1211
1212
1213LUA_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