Format

values_cut_over(Alist, Max, inclusive=0)

Returns

Number of items removed

Args

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

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

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

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

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_under proc