I have a table called 'tdata' with the following information.
I use the following to sort the data ascending.
This above sorts the table correctly and outputs the following in the correct Ascending order:
Here is where I'm having trouble visualizing the next step. I want to be able to do two things.
1) I want the value of each damage type listed. (ie, '2 SONIC -92' from above data)
2) I want to be able to ColourNote each line based on a value. For instance, if value is < 0 make the text green. Using the above data it would make '2 Sonic -92' a green color.
Any suggestions ?
Much Thanks for reading.
"LIGHT"=0
"SONIC"=-92
"NEGATIVE"=0
"HOLY"=0
"SLASH"=0
"MENTAL"=0
"EARTH"=-80
"MAGIC"=0
"AIR"=0
"FIRE"=0
"ELECTRIC"=-300
"WATER"=248
"ACID"=0
"SHADOW"=0
"BASH"=0
"PIERCE"=0
"POISON"=0
"COLD"=136
"ENERGY"=0
"DISEASE"=0
I use the following to sort the data ascending.
t = {}
for k, v in pairs (tdata) do
table.insert (t, k)
end -- for
table.sort (t, function (c, d) return tdata [c] < tdata [d] end)
table.foreach (t, print)
This above sorts the table correctly and outputs the following in the correct Ascending order:
1 ELECTRIC
2 SONIC
3 EARTH
4 LIGHT
5 ACID
6 SHADOW
7 BASH
8 POISON
9 PIERCE
10 ENERGY
11 FIRE
12 DISEASE
13 AIR
14 NEGATIVE
15 SLASH
16 HOLY
17 MAGIC
18 MENTAL
19 COLD
20 WATER
Here is where I'm having trouble visualizing the next step. I want to be able to do two things.
1) I want the value of each damage type listed. (ie, '2 SONIC -92' from above data)
2) I want to be able to ColourNote each line based on a value. For instance, if value is < 0 make the text green. Using the above data it would make '2 Sonic -92' a green color.
Any suggestions ?
Much Thanks for reading.