Files
community_bridge/modules/framework/_default/client.lua
T

30 lines
883 B
Lua
Raw Normal View History

2025-08-31 22:49:12 -04:00
---@diagnostic disable: duplicate-set-field
2025-05-15 11:16:37 -04:00
Framework = Framework or {}
2025-08-31 22:49:12 -04:00
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.
2025-09-01 02:31:14 -04:00
---@param tbl table
2025-08-31 22:49:12 -04:00
---@return number
Framework.GetJobCountTotal = function(tbl)
local total = 0
for _, jobName in pairs(tbl) do
total = total + Framework.GetJobCount(jobName)
end
return total
end
2025-05-15 11:16:37 -04:00
return Framework