Skip to content

Instantly share code, notes, and snippets.

@balaam
Created April 30, 2015 06:35
Show Gist options
  • Select an option

  • Save balaam/16319943104fa7736390 to your computer and use it in GitHub Desktop.

Select an option

Save balaam/16319943104fa7736390 to your computer and use it in GitHub Desktop.
list =
{
{ y = 2 },
{ y = 3 },
{ y = 1 },
{ y = 1 },
{ y = 8 },
}
table.sort(list, function(a, b) return a.y > b.y end)
print("list =")
print("{")
for k, v in ipairs(list) do
print(string.format(" { y = %d }", v.y))
end
print("}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment