Diff

util/statistics.lua @ 6562:2b5ced5ca31f

util.statistics: Return 0 as percentile if data out of range
author Matthew Wild <mwild1@gmail.com>
date Fri, 30 Jan 2015 14:21:51 +0000
parent 6555:7b2d16c14659
child 6649:99fa40d498cc
line wrap: on
line diff
--- a/util/statistics.lua	Mon Jan 26 15:25:16 2015 +0100
+++ b/util/statistics.lua	Fri Jan 30 14:21:51 2015 +0000
@@ -8,7 +8,7 @@
 	local n = pc/100 * (length + 1);
 	local k, d = m_floor(n), n%1;
 	if k == 0 then
-		return arr[1];
+		return arr[1] or 0;
 	elseif k >= length then
 		return arr[length];
 	end