Problem with table.sort (tables in table)

So I want to sort this table from highest to lowest in function of the second value:

local PlayersAndPoints = {
    {"Player1", 20};
    {"Player2", 35};
    {"Player3", 15};
}

I tried this script:

local PlayersAndPointsSorted = table.sort(PlayersAndPoints,
	function (a,b)
		return a[2] > b[2]
	end)

for i,v in pairs(PlayersAndPointsSorted) do
    print(v[1].." - "..v[2])
end

But the table just equals nil. What can I do?

table.sort doesn’t return a new table, instead it performs the sorting operation to the existing table, for example:

local PlayersAndPoints = {
	{"Player1", 20},
	{"Player2", 35},
	{"Player3", 15},
}

function sortTable(a, b)
	return a[2] < b[2]
end

table.sort(PlayersAndPoints, sortTable)
	
for i,v in pairs(PlayersAndPoints) do
	print(v[1].." - "..v[2])
end

This code will display the expected result.