| 1255 | |
| 1256 | |
| 1257 | LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { |
| 1258 | StkId fi = index2addr(L, fidx); |
| 1259 | switch (ttype(fi)) { |
| 1260 | case LUA_TLCL: { /* lua closure */ |
| 1261 | return *getupvalref(L, fidx, n, NULL); |
| 1262 | } |
| 1263 | case LUA_TCCL: { /* C closure */ |
| 1264 | CClosure *f = clCvalue(fi); |
| 1265 | api_check(L, 1 <= n && n <= f->nupvalues, "invalid upvalue index"); |
| 1266 | return &f->upvalue[n - 1]; |
| 1267 | } |
| 1268 | default: { |
| 1269 | api_check(L, 0, "closure expected"); |
| 1270 | return NULL; |
| 1271 | } |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | |
| 1276 | LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, |
no test coverage detected