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