Format

values_sum(Alist)

Returns

The sum of all associated numbers in Alist

Args

Alist: An associative list or alist

Returns the sum of all associated values in this list that are numbers. Other values, including vectors, are not summed.

var/list/weights = list(/obj/crate = 12, /obj/vase = 1)
usr << values_sum(weights)  // outputs 13

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

If Alist is not an associative list, the result is 0.

See also