I've been confused while trying to make a script that picks the biggest number in a table
local table = {50,12,78}
for i,v in pairs(table) do
--what do i do here?
end
I've been confused while trying to make a script that picks the biggest number in a table
local table = {50,12,78}
for i,v in pairs(table) do
--what do i do here?
end
Try this:
local table = {50,12,78}
local highest = 0
for i,v in pairs(table) do
if v > highest then
highest = v
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Thanks
table.sort is better