I have a list of numbers in a table I want to sort from least to greatest, how would I go about doing that?
t = {1, 3, 2} table.sort(t)
That's what I have, but I'm not sure what to do from there.
The second parameter of table.sort is a function that compares two numbers of the entire table and evaluates their position
local t = {1, 3, 2} table.sort(t, function(a, b) return a < b end)
This will say "okay so 1 < 3 which means it should stay where it is"
If you would like to make it go from greatest to least, just change the "<" to a ">"