| 1421 | |
| 1422 | |
| 1423 | LUA_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 | |
| 1445 | LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, |
no test coverage detected