/* Try to find a boundary in table 't'. A 'boundary' is an integer index such that t is non-nil and t is nil (and 0 if t is nil).  */
lua_Unsigned luaH_getn(Table *t)
/* Try to find a boundary in table 't'. A 'boundary' is an integer index such that t is non-nil and t is nil (and 0 if t is nil).  */
lua_Unsigned luaH_getn(Table *t)
{
    unsigned int i = 0;
    while (j - i > 1) {
      unsigned int m = (i+j)/2;
      if (ttisnil(&t->array[m - 1])) j = m;
      else i = m;
    }
    return i;
  }
  else if (isdummy(t))
    return j;
  else return unbound_search(t, j);
}