Files
community_bridge/modules/framework/_default/client.lua
T
MrNewb e9fa5a2891 Fix type annotation for job count function
Updated the type annotation for the 'tbl' parameter in Framework.GetJobCountTotal from 'any' to 'table' for improved clarity and correctness.
2025-09-01 02:31:14 -04:00

30 lines
883 B
Lua

---@diagnostic disable: duplicate-set-field
Framework = Framework or {}
local currentJobCounts = GlobalState.jobcounts or {}
AddStateBagChangeHandler('jobcounts', 'global', function(bagName, key, value)
if not value then currentJobCounts = {} return end
currentJobCounts = value
end)
---This is an internal function that will be used to retrieve job counts later.
---@param jobName string
---@return number
Framework.GetJobCount = function(jobName)
if not currentJobCounts[jobName] then return 0 end
return currentJobCounts[jobName]
end
---This will allow passing a table of job names and returning a sum of the total count.
---@param tbl table
---@return number
Framework.GetJobCountTotal = function(tbl)
local total = 0
for _, jobName in pairs(tbl) do
total = total + Framework.GetJobCount(jobName)
end
return total
end
return Framework