Dear Sirs,
Seems like I’am totally lost in a matter of sorting tables syntax. Maybe some example wold make it easier.
Well, I have a table with mobs and rooms.
table = {
{ mob = 4, room = 3 },
{ mob = 5, room = 1 },
{ mob = 2, room = 3 },
{ mob = 3, room = 5 },
{ mob = 1, room = 1 }
}
So I need to sort it by the room number and I just can’t get it.
table.sort(table, function(a,b)
local a = table[1].room
local b = table[2].room
return a < b
end)
Thanks!