Forum
Scripts
highest value in table
highest value in table
8 replies
1

I think it works with math.max but idk the parameter...
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
function tablemax(t) 	if t==nil then return 0 end 	if #t==0 then return 0 end 	max=t[1] 	for i=2,#t do 		if t[i]>max then 			max=t[i] 		end 	end 	return max end
untested
DC, thanks, it works. 1
2
3
2
3
function tablemax(t) 	return math.max(unpack(t)) end
Would that work?
(In reply to
Bowlinghead) That should work fine
1

Offline