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