Module:Sprintf

From Illerai

This is an old revision of this page, as edited by illerai>Gaz Lloyd at 16:55, 24 September 2019 (copy from rsw). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Module documentation
This documentation is transcluded from Module:Sprintf/doc. [edit] [history] [purge]

This template should be used when there is no documentation for a Module or Template.


local p = {}

function p.main(frame)
	return p._main(frame:getParent().args)
end

function p._main(args)
	local _args = {}
	for i,v in ipairs(args) do
		table.insert(_args, v)
	end
	return string.format(unpack(_args))
end

function p.expr(frame)
	return p._expr(frame:getParent().args)
end

function p._expr(args)
	return string.format(args[1], mw.ext.ParserFunctions.expr(args[2]))
end

return p