Specifically, table.sort() uses this wonderful gem:
table.sort(data, function(a,b) return a.DPS\>b.DPS end)
Now, I’ve learned earlier (couldn’t for the life of me find this in the official LUA docs, but it’s in the Corona APIs) that you can substitute table categories with variables like this:
local somename = DPS
data[i][somename]
But in the table.sort() function above, no such luck. a[somename], a.[somename], and a.somename all fail - the last, I assume, because it’s looking for a literal “variable” category.
So…putting my newbie dunce cap back on, how do you refer to a variable in this sort of situation?
Cheers. [import]uid: 41884 topic_id: 14264 reply_id: 314264[/import]
