math.listMean

From RPTools Wiki
Revision as of 19:23, 16 May 2020 by Selquest (talk | contribs) (Adding documentation for math.listMean() function coming in 1.7)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

math.listMean() Function

Introduced in version 1.7
Calculates the arithmetic mean of the contents of a String List. Only allows numeric elements - any non-numeric values will produce an error. The mean is equal to the sum of all the list's contents divided by the number of elements.

Usage

[h: result = math.listMean(array)]

Examples

[h: list1 = "1,2,3,3,10"]
[r: math.listMean(list1)]
[h: list2 = "1#2#3#4#1#2#3#0#2"]
[r: math.listMean(list2,"#")]

Returns:

 3.8
 2