Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:ArgConcat: Difference between revisions

From FiguraMC
PenguinEncounter (talk | contribs)
tiny utility module
 
PenguinEncounter (talk | contribs)
No edit summary
Line 1: Line 1:
return {
return {
concat = function(frame)
concat = function(frame)
return table.concat(frame:getParent().args, frame.args.joiner or ", ")
local modified = {}
local template = frame.args.wrap_with or '$$'
for _, v in ipairs(frame:getParent().args) do
table.insert(modified, template:gsub("%$%$", v))
end
return table.concat(modified, frame.args.joiner or ", ")
end
end
}
}

Revision as of 02:47, 29 September 2024

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

return {
	concat = function(frame)
		local modified = {}
		local template = frame.args.wrap_with or '$$'
		for _, v in ipairs(frame:getParent().args) do
			table.insert(modified, template:gsub("%$%$", v))
		end
		return table.concat(modified, frame.args.joiner or ", ")
	end
}