Module:ConfigHelpers: Difference between revisions

// via Wikitext Extension for VSCode
 
// via Wikitext Extension for VSCode
Line 4: Line 4:
-- This module provides utility functions for working with configuration data
-- This module provides utility functions for working with configuration data
-- that are used by ConfigRepository and potentially other modules.
-- that are used by ConfigRepository and potentially other modules.
-- It is designed to avoid circular dependencies by containing only
-- pure utility functions that don't depend on ConfigRepository data.


local p = {}
local p = {}


-- Recursively merges two tables, with values from source overriding target
-- Recursively merges two tables, with values from source overriding target; arrays are concatenated, other nested tables are recursively merged
-- Arrays are concatenated, other nested tables are recursively merged
function p.deepMerge(target, source)
function p.deepMerge(target, source)
     if type(source) ~= 'table' or type(target) ~= 'table' then
     if type(source) ~= 'table' or type(target) ~= 'table' then