| 1429 | |
| 1430 | |
| 1431 | LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { |
| 1432 | TValue *fi = index2value(L, fidx); |
| 1433 | switch (ttypetag(fi)) { |
| 1434 | case LUA_VLCL: { /* lua closure */ |
| 1435 | return *getupvalref(L, fidx, n, NULL); |
| 1436 | } |
| 1437 | case LUA_VCCL: { /* C closure */ |
| 1438 | CClosure *f = clCvalue(fi); |
| 1439 | if (1 <= n && n <= f->nupvalues) |
| 1440 | return &f->upvalue[n - 1]; |
| 1441 | /* else */ |
| 1442 | } /* FALLTHROUGH */ |
| 1443 | case LUA_VLCF: |
| 1444 | return NULL; /* light C functions have no upvalues */ |
| 1445 | default: { |
| 1446 | api_check(L, 0, "function expected"); |
| 1447 | return NULL; |
| 1448 | } |
| 1449 | } |
| 1450 | } |
| 1451 | |
| 1452 | |
| 1453 | LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, |
no test coverage detected