/* clear entries with unmarked values from all weaktables in list 'l' up to element 'f'  */
static void clearvalues(global_State *g, GCObject *l, GCObject *f)
/* clear entries with unmarked values from all weaktables in list 'l' up to element 'f'  */
static void clearvalues(global_State *g, GCObject *l, GCObject *f)
{
    Table *h = gco2t(l);
    Node *n, *limit = gnodelast(h);
    int i;
    for (i = 0; i < h->sizearray; i++) {
      TValue *o = &h->array[i];
      if (iscleared(g, o))
        setnilvalue(o);
    }
    for (n = gnode(h, 0); n < limit; n++) {
      if (!ttisnil(gval(n)) && iscleared(g, gval(n))) {
        setnilvalue(gval(n));
        removeentry(n);
      }
    }
  }
}