MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / lua_upvalueid

Function lua_upvalueid

3rd/lua-5.4.3/src/lapi.c:1423–1442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1421
1422
1423LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) {
1424 TValue *fi = index2value(L, fidx);
1425 switch (ttypetag(fi)) {
1426 case LUA_VLCL: { /* lua closure */
1427 return *getupvalref(L, fidx, n, NULL);
1428 }
1429 case LUA_VCCL: { /* C closure */
1430 CClosure *f = clCvalue(fi);
1431 if (1 <= n && n <= f->nupvalues)
1432 return &f->upvalue[n - 1];
1433 /* else */
1434 } /* FALLTHROUGH */
1435 case LUA_VLCF:
1436 return NULL; /* light C functions have no upvalues */
1437 default: {
1438 api_check(L, 0, "function expected");
1439 return NULL;
1440 }
1441 }
1442}
1443
1444
1445LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1,

Callers 1

checkupvalFunction · 0.85

Calls 2

index2valueFunction · 0.85
getupvalrefFunction · 0.85

Tested by

no test coverage detected