MCPcopy Create free account
hub / github.com/DFHack/dfhack / lua_upvalueid

Function lua_upvalueid

depends/lua/src/lapi.c:1267–1283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1265
1266
1267LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) {
1268 StkId fi = index2addr(L, fidx);
1269 switch (ttype(fi)) {
1270 case LUA_TLCL: { /* lua closure */
1271 return *getupvalref(L, fidx, n);
1272 }
1273 case LUA_TCCL: { /* C closure */
1274 CClosure *f = clCvalue(fi);
1275 api_check(L, 1 <= n && n <= f->nupvalues, "invalid upvalue index");
1276 return &f->upvalue[n - 1];
1277 }
1278 default: {
1279 api_check(L, 0, "closure expected");
1280 return NULL;
1281 }
1282 }
1283}
1284
1285
1286LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1,

Callers 1

db_upvalueidFunction · 0.85

Calls 2

index2addrFunction · 0.85
getupvalrefFunction · 0.85

Tested by

no test coverage detected