Posted 28 November 2013 - 07:11 PM
Hi, I would like to be able to sort a table by a value inside of it - not very well explained, but here's my code:
How would I sort the new ordertbl by things[thing].name ?
db = {
things = {
["thing"] = {
name = "bla",
owner = "bla",
someOtherValue = "bla",
}
["another_thing"] = {
name = "bla",
owner = "bla",
someOtherValue = "bla",
}
}
}
ordertbl = {}
--Insert the tables from db.things into an ordered table
for name,data in pairs(db.things) do
table.insert(ordertbl, db.things[name])
end
How would I sort the new ordertbl by things[thing].name ?
Edited on 28 November 2013 - 06:40 PM