| 1381 | |
| 1382 | |
| 1383 | LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { |
| 1384 | TValue *fi = index2value(L, fidx); |
| 1385 | switch (ttypetag(fi)) { |
| 1386 | case LUA_VLCL: { /* lua closure */ |
| 1387 | return *getupvalref(L, fidx, n, NULL); |
| 1388 | } |
| 1389 | case LUA_VCCL: { /* C closure */ |
| 1390 | CClosure *f = clCvalue(fi); |
| 1391 | api_check(L, 1 <= n && n <= f->nupvalues, "invalid upvalue index"); |
| 1392 | return &f->upvalue[n - 1]; |
| 1393 | } |
| 1394 | default: { |
| 1395 | api_check(L, 0, "closure expected"); |
| 1396 | return NULL; |
| 1397 | } |
| 1398 | } |
| 1399 | } |
| 1400 | |
| 1401 | |
| 1402 | LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, |
no test coverage detected