| 1265 | |
| 1266 | |
| 1267 | LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { |
| 1268 | StkId fi = index2addr(L, fidx); |
| 1269 | switch (ttype(fi)) { |
| 1270 | case LUA_TLCL: { /* lua closure */ |
| 1271 | return *getupvalref(L, fidx, n); |
| 1272 | } |
| 1273 | case LUA_TCCL: { /* C closure */ |
| 1274 | CClosure *f = clCvalue(fi); |
| 1275 | api_check(L, 1 <= n && n <= f->nupvalues, "invalid upvalue index"); |
| 1276 | return &f->upvalue[n - 1]; |
| 1277 | } |
| 1278 | default: { |
| 1279 | api_check(L, 0, "closure expected"); |
| 1280 | return NULL; |
| 1281 | } |
| 1282 | } |
| 1283 | } |
| 1284 | |
| 1285 | |
| 1286 | LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, |
no test coverage detected