| 1547 | |
| 1548 | |
| 1549 | LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { |
| 1550 | TValue *fi = index2value(L, fidx); |
| 1551 | switch (ttypetag(fi)) { |
| 1552 | case LUA_VLCL: { /* lua closure */ |
| 1553 | return *getupvalref(L, fidx, n, NULL); |
| 1554 | } |
| 1555 | case LUA_VCCL: { /* C closure */ |
| 1556 | CClosure *f = clCvalue(fi); |
| 1557 | if (1 <= n && n <= f->nupvalues) |
| 1558 | return &f->upvalue[n - 1]; |
| 1559 | /* else */ |
| 1560 | } /* FALLTHROUGH */ |
| 1561 | case LUA_VLCF: |
| 1562 | return NULL; /* light C functions have no upvalues */ |
| 1563 | default: { |
| 1564 | api_check(L, 0, "function expected"); |
| 1565 | return NULL; |
| 1566 | } |
| 1567 | } |
| 1568 | } |
| 1569 | |
| 1570 | |
| 1571 | LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, |
no test coverage detected