| 1370 | |
| 1371 | |
| 1372 | static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { |
| 1373 | LClosure *f; |
| 1374 | TValue *fi = index2value(L, fidx); |
| 1375 | api_check(L, ttisLclosure(fi), "Lua function expected"); |
| 1376 | f = clLvalue(fi); |
| 1377 | api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index"); |
| 1378 | if (pf) *pf = f; |
| 1379 | return &f->upvals[n - 1]; /* get its upvalue pointer */ |
| 1380 | } |
| 1381 | |
| 1382 | |
| 1383 | LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { |
no test coverage detected