Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to sort an Array of numbers from High to low?

If you had 3 numbers in an array/table like this:

local Scores = {2, 7, 3}

How would you sort them all from high to low or the other way around...

2 answers

If you want to be able to choose which way you can sort the numbers. Please consider using the method down below.

table.sort(table, function(a, b) return a > b end))

You can change the relational conditional operator to fit any need you want.

1 comment

0

does the a and b mean the first and last number

This discussion is preserved as it was. New answers, comments, and votes are closed.