consolidated patterns

This commit is contained in:
Michael Freno
2025-11-18 16:01:39 -05:00
parent 5bb1162e06
commit 0b0f0e1eb7
9 changed files with 220 additions and 171 deletions

View File

@@ -5,14 +5,17 @@ local ErrorHandler = nil
--- Initialize Units module with Context dependency
---@param context table The Context module
function Units.initialize(context)
Context = context
end
--- Initialize ErrorHandler dependency
---@param errorHandler table The ErrorHandler module
function Units.initializeErrorHandler(errorHandler)
ErrorHandler = errorHandler
--- Initialize dependencies
---@param deps table Dependencies: { Context = Context?, ErrorHandler = ErrorHandler? }
function Units.init(deps)
if type(deps) == "table" then
if deps.Context then
Context = deps.Context
end
if deps.ErrorHandler then
ErrorHandler = deps.ErrorHandler
end
end
end
---@param value string|number