Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 17:09, 30 August 2025 by MTOnline (talk | contribs) (Created page with "local utils = {} function utils.expand(frame, title, ...) local args = {...} local templateArgs = {} for i, arg in ipairs(args) do if type(arg) == "string" and arg:match("^[^=]+=.+$") then local key, value = arg:match("^([^=]+)=(.+)$") templateArgs[key] = value else templateArgs[i] = tostring(arg) end end if frame.expandTemplate then return frame:expandTemplate{ title = title, args = templateArgs } else local argString = {} for i, arg in i...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Utils/doc

local utils = {}

function utils.expand(frame, title, ...)
	local args = {...}
	local templateArgs = {}
	
	for i, arg in ipairs(args) do
		if type(arg) == "string" and arg:match("^[^=]+=.+$") then
			local key, value = arg:match("^([^=]+)=(.+)$")
			templateArgs[key] = value
		else
			templateArgs[i] = tostring(arg)
		end
	end
	
	if frame.expandTemplate then
		return frame:expandTemplate{ title = title, args = templateArgs }
	else
		local argString = {}
		for i, arg in ipairs(args) do
			table.insert(argString, tostring(arg))
		end
		return string.format("{{%s|%s}}", title, table.concat(argString, "|"))
	end
end

return utils