/* Check whether a given upvalue from a given closure exists and returns its index  */
static void* checkupval(lua_State *L, int argf, int argnup, int *pnup)
/* Check whether a given upvalue from a given closure exists and returns its index  */
static void* checkupval(lua_State *L, int argf, int argnup, int *pnup)
{
    luaL_argcheck(L, id != NULL, argnup, "invalid upvalue index");
    *pnup = nup;
  }
  return id;
}