fix(ui): broken getTotalCount function
This commit is contained in:
parent
be9e57ebd7
commit
e451631810
@ -5,9 +5,9 @@ local config = {
|
||||
}
|
||||
|
||||
local countersMap = {
|
||||
iron = 1,
|
||||
yolo = 2,
|
||||
truc = 3
|
||||
{ name = "iron", count = 1 },
|
||||
{ name = "dye", count = 2 },
|
||||
{ name = "experience", count = 3 }
|
||||
}
|
||||
|
||||
local result = CountersSelector(countersMap, config)
|
||||
|
||||
@ -19,8 +19,10 @@ end
|
||||
|
||||
local function getTotalCount(countersMap)
|
||||
local total = 0
|
||||
for _, counter in pairs(countersMap) do
|
||||
total = total + (counter or 0)
|
||||
for _, counterPayload in pairs(countersMap) do
|
||||
if counterPayload then
|
||||
total = total + (counterPayload.count or 0)
|
||||
end
|
||||
end
|
||||
return total
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user