I am trying to sort a table by the magnitude of a vector3
Data structure:
chunks_to_generate = {
[“1,1”] = 1, 0, 1
[“1,2”] = 1, 0, 2
}
sorting code:
– sort by distance from word origin
table.sort(chunks_to_generate, function(a,b)
return a.Magnitude > b.Magnitude
end)
Problem: table is not sorted at all