Zelda Wiki

Want to contribute to this wiki?
Sign up for an account, and get started!

Come join the Zelda Wiki community Discord server!

READ MORE

Zelda Wiki
Advertisement

Documentation for this module may be created at Module:UtilsPackage/Documentation

local p = {}

local utilsTable = require("Module:UtilsTable")

function p.submodules(submodules)
	local module = {}
	local moduleDoc = {}
	for submoduleKey, submodulePage in pairs(submodules) do
		local submodule = require(submodulePage)
		for exportKey, export in pairs(submodule) do
			if exportKey == "Schemas" then
				module.Schema = utilsTable.merge({}, module.Schema, submodule.Schema)
			elseif module[exportKey] and exportKey ~= "Documentation" then
				mw.addWarning(string.format("Module conflict: <code>%s</code> is exported by more than one submodule.", exportKey))
			end
			module[exportKey] = export
		end
		moduleDoc[submoduleKey] = submodulePage
	end
	module.Documentation = { sections = moduleDoc }
	return module
end

return p
Advertisement