-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackerBuilder.lua
45 lines (42 loc) · 1.14 KB
/
packerBuilder.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
local ret = {
hash = {},
deduplicated = {},
filter = T{
"AugPath",
"AugRank",
"AugTrial",
"Augment",
"Bag"
}
}
function ret:process(t)
if t == nil then
print("Nil was passed to packerBuilder:process")
return
end
for k, v in pairs(t) do
if not self.filter:find(k) then
if type(v) == "string" then
if self.hash[v] == nil then
self.deduplicated[#self.deduplicated + 1] = v
self.hash[v] = true
end
elseif v.Name then
if self.hash[v.Name] == nil then
self.hash[v.Name] = true
if v.Quantity then
self.deduplicated[#self.deduplicated + 1] = {Name = v.Name, Quantity = v.Quantity}
else
self.deduplicated[#self.deduplicated + 1] = v.Name
end
end
elseif type(v) == "table" then
self:process(v)
end
end
end
end
function ret:get()
return self.deduplicated
end
return ret