I am attempting to sort a table from smallest to largest numbers using table.sort() but I am a little confused as to how table.sort works. The second argument in table.sort confuses me and there isnt any wiki info on it.

Can anyone help me out? Thank you. :)

4 comments

0

table.sort(tab, function(a, b) return a < b end)

0

Can you explain what the second argument is, I know its a function but like how does that work?

0

Like what would I put in place of a and b and stuff.