/* Check whether object at given level has a close metamethod and raise an error if not.  */
static void checkclosemth(lua_State *L, StkId level)
/* Check whether object at given level has a close metamethod and raise an error if not.  */
static void checkclosemth(lua_State *L, StkId level)
{
    int idx = cast_int(level - L->ci->func);
    const char *vname = luaG_findlocal(L, L->ci, idx, NULL);
    if (vname == NULL) vname = "?";
    luaG_runerror(L, "variable '%s' got a non-closable value", vname);
  }
}