** Check whether a given upvalue from a given closure exists and ** returns its index */
| 283 | ** returns its index |
| 284 | */ |
| 285 | static void *checkupval (lua_State *L, int argf, int argnup, int *pnup) { |
| 286 | void *id; |
| 287 | int nup = (int)luaL_checkinteger(L, argnup); /* upvalue index */ |
| 288 | luaL_checktype(L, argf, LUA_TFUNCTION); /* closure */ |
| 289 | id = lua_upvalueid(L, argf, nup); |
| 290 | if (pnup) { |
| 291 | luaL_argcheck(L, id != NULL, argnup, "invalid upvalue index"); |
| 292 | *pnup = nup; |
| 293 | } |
| 294 | return id; |
| 295 | } |
| 296 | |
| 297 | |
| 298 | static int db_upvalueid (lua_State *L) { |
no test coverage detected