So my current problem is that my huge table is getting very difficult to see things in. I've tried to sort it using information from the following posts:
http://www.mushclient.com/forum/bbshowpost.php?id=6036
http://www.mushclient.com/forum/bbshowpost.php?id=8491
http://www.mushclient.com/forum/bbshowpost.php?id=8608
http://www.mushclient.com/forum/bbshowpost.php?id=5643
The table itself, printed with tprint, looks sort of like this:
all that did for me was the following...
http://www.mushclient.com/forum/bbshowpost.php?id=6036
http://www.mushclient.com/forum/bbshowpost.php?id=8491
http://www.mushclient.com/forum/bbshowpost.php?id=8608
http://www.mushclient.com/forum/bbshowpost.php?id=5643
The table itself, printed with tprint, looks sort of like this:
Quote:
1:
"name"="Relay"
"finish1"="Handoff"
"attack1"="Point"
"level"=1
2:
"name"="Busboy"
"finish1"="Ringup"
"attack1"="Clean"
"level"=1
As you can see, I'm using numbers as the main identifier for the bits (table[1], table[2], etc). I want it to sort by the actual names inside the table though, so I want it to look like:1:
"name"="Relay"
"finish1"="Handoff"
"attack1"="Point"
"level"=1
2:
"name"="Busboy"
"finish1"="Ringup"
"attack1"="Clean"
"level"=1
Quote:
1:
"attack1"="Point"
"finish1"="Handoff"
"level"=1
"name"="Relay"
2:
"attack1"="Clean"
"finish1"="Ringup"
"level"=1
"name"="Busboy"
So I just want it alphabetically sorted on each inner entry... I tried doing table.sort(table[1]) and that didn't change anything... table.sort(table[1], alphanum(table[1])) also runs, but doesn't seem to change anything. I know there's some sort of thing involving making a new table to sort it, but when I ran this:1:
"attack1"="Point"
"finish1"="Handoff"
"level"=1
"name"="Relay"
2:
"attack1"="Clean"
"finish1"="Ringup"
"level"=1
"name"="Busboy"
Quote:
/table2 = {} table.foreach (table, function (k) table.insert (table2, k) end) table.sort(table2) tprint(table2)
/table2 = {} table.foreach (table, function (k) table.insert (table2, k) end) table.sort(table2) tprint(table2)
all that did for me was the following...
Quote:
1=1
2=2
which isn't especially useful. :) It appears that's the way it's supposed to be working, but what I want it to do is to grab the attack1/finish1/etc, and update the original table... if that means I need to make a temporary table that's been sorted, do table[1] = temptable, temptable = {} between each, that works... I just want it to work and be readable as opposed to the painful mess it's becoming with 269 lines in it currently, sorted only by whatever internal logic determines initial placement.
1=1
2=2