Module:Sprintf

From RuneRealm Wiki

This is the current revision of this page, as edited by Alex (talk | contribs) at 00:13, 17 October 2024 (Created page with "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"). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Module documentation
This documentation is transcluded from Template:No documentation/doc. [edit] [history] [purge]
This module does not have any documentation. Please consider adding documentation at Module:Sprintf/doc. [edit]
Module:Sprintf's function expr is invoked by Template:Sprintfexpr.
Module:Sprintf's function main is invoked by Template:Sprintf.

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