Format

values_cut_under(Alist, Min, inclusive=0)

Returns

Number of items removed

Args

  • Alist: An associative list or alist
  • Min: The maximum number allowed
  • inclusive: Also cut items whose value equals Min

Removes all items from the list whose associated values are less than Min, not numbers, or NaN.

If the optional inclusive argument is true, items with associated values equal to Min are removed also.

var/list/stuff = list("a"=1, "b"=2, "c"=-4)
values_cut_under(stuff, 0)
for(var/k,v in stuff)
    usr << "[k] = [v]"
// prints:
// a = 1
// b = 2

This is a convenience proc for games trying to eke out high performance.

If Alist is not an associative list, nothing happens.

See also

values_cut_over proc