From Second Life Wiki
ListStatistics
llListStatistics
Description
Function: float llListStatistics( integer operation, list src );
Returns a float that is the result of performing statistical aggregate function operation on src.
| • integer
| operation
| –
| a LIST_STAT_* flag
|
|
| • list
| src
|
|
|
|
If a list entry type is not a float or an integer it is silently ignored.
Examples
// shows just how bad SL is behaving and demonstrates the use of llListStatistics()
list dil_s;
list fps_s;
integer ticks;
default
{
state_entry()
{
llSetTimerEvent(1.0);
}
on_rez (integer parm)
{
llResetScript();
}
timer()
{
dil_s = llList2List(dil_s + llGetRegionTimeDilation(), -60, -1);
fps_s = llList2List(fps_s + llGetRegionFPS(), -60, -1);
if(3 > ++ticks)
{
llSetText(
"Dilation: min="+(string) llListStatistics(LIST_STAT_MIN, dil_s) + ", mean=" +
(string) llListStatistics(LIST_STAT_MEAN, dil_s) + ", max=" +
(string) llListStatistics(LIST_STAT_MAX, dil_s) + ", std.dev=" +
(string) llListStatistics(LIST_STAT_STD_DEV, dil_s) + "\n" +
"FPS: min="+(string) llListStatistics(LIST_STAT_MIN, fps_s) + ", mean=" +
(string) llListStatistics(LIST_STAT_MEAN, fps_s) + ", max=" +
(string) llListStatistics(LIST_STAT_MAX, fps_s) + ", std.dev=" +
(string) llListStatistics(LIST_STAT_STD_DEV, fps_s),
<1.0, 1.0, 0.0>, //yellow
1.0);
}
}
changed(integer change)
{
if(change & CHANGED_REGION)
{
llResetScript();
}
}
}
Notes
Given that this operation ignores any non-numbers in a list, it can be used to tell you, in a mixed list, how many of the elements in a list are numbers (when used with the LIST_STAT_NUM_COUNT parameter.)