Help with a Table

So I am working on a mini-game and it has rounds to it and at the end of all the rounds it inserts all the players who have won a round into a table



local winners= {}
for k,v in pairs(player.GetAll()) do
	if v.Wins != 0 then
		table.insert( winners, v )
	end
end


I am try to figure out how to sort the table from the greatest amount of wins to the smallest.

This may help you: http://wiki.garrysmod.com/page/table/SortByMember

Wins would be the “Key”.

And, you’re inserting the player entity instead of the list… You may need to process the table differently if it doesn’t let you sort by v.Wins but I haven’t messed around with using meta-tables / objects using table.SortByMember…