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