Files

40 lines
1.2 KiB
Lua
Raw Permalink 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 {}
---@description State bag change handler to update job counts when global state changes
---@param bagName string
---@param key string
---@param value table|nil
2025-08-31 22:49:12 -04:00
AddStateBagChangeHandler('jobcounts', 'global', function(bagName, key, value)
if not value then currentJobCounts = {} return end
currentJobCounts = value
end)
---@description This will get the name of the in use resource.
2025-09-10 12:27:12 -04:00
---@return string
Framework.GetResourceName = function()
return 'default'
end
---@description This is an internal function that will be used to retrieve job counts later.
2025-08-31 22:49:12 -04:00
---@param jobName string
---@return number
Framework.GetJobCount = function(jobName)
if not currentJobCounts[jobName] then return 0 end
return currentJobCounts[jobName]
end
---@description 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