What I can do is to explain my code. I will use this data
local BangCharHateds = {
["Paco"] = true,
["Anabel"] = true,
["Francisco"] = true,
}
local BangCharKills = {
["Tarmanu"] = 43,
["Anabel"] = 56,
["Armario"] = 23,
["Paco"] = 56,
["Francisco"] = 11,
["Casiopea"] = 22,
["Artamundo"] = 16,
["Costera"] = 7,
}
numbers
This is an array.
Hence keys are 1,2,3,...
#numbers is the number of DISTINCT kill counts
numbers[1] = 56
numbers[2] = 11
names
This is a hash table.
keys are kills counts
values are arrays of all names with that kill count
names = {} --hash table
names[56] = {} --array
names[56][1] = "Anabel"
names[56][2] = "Paco"
name[11] = {} --array
name[11][1] = {"Francisco"}
So my loops were traversing numbers in decrescent order and then for each number looping through all names, then going to the next highest kill count, listing all names with the kill count and so on.
__________________
"In this world nothing can be said to be certain, except that fractional reserve banking is a Ponzi scheme and that you won't believe it." - Mandrill
Last edited by Banknorris : 08-07-17 at 06:23 PM.
|