Or you just make it an array from the start...
Code:
["subsList"] = {
{
["toon"] = "AToonName",
["note"] = "",
["updatednice"] = "20:38",
["addednice"] = "20:38",
["added"] = 1276254517,
["updated"] = 1276254517,
},
{
["toon"] = "DToonName",
["note"] = "hmmm",
["updatednice"] = "20:38",
["addednice"] = "20:38",
["added"] = 1276254503,
["updated"] = 1276254530,
},
{
["toon"] = "AToonName2",
["note"] = "yo",
["updatednice"] = "20:39",
["addednice"] = "20:38",
["added"] = 1276254528,
["updated"] = 1276254553,
},
{
["toon"] = "NToonName",
["note"] = "woah",
["updated"] = 1276254802,
["added"] = 1276254517,
["addednice"] = "20:38",
},
{
["toon"] = "KToonName",
["note"] = "",
["updatednice"] = "20:39",
["addednice"] = "20:38",
["added"] = 1276254521,
["updated"] = 1276254574,
},
},
Then you just can do
Code:
table.sort(sometable.subsList, function(a,b) return a.toon > b.toon end)
Since you don't need the name as a key if you already store it in the subtable anyway. It's just redundant. If you use your keys somewhere in your code, just think hard, there is always another way.