Module:No ping

From The Sims Wiki, a collaborative database for The Sims series
This is the current revision of this page, as edited by K6ka (talk | contribs) at 12:02, 29 May 2019 (Created page with "-- This module implements {{noping}}. local p = {} function p.main(frame) local args = frame:getParent().args return p._main(args) end function p._main(arg..."). 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

This module's documentation page can be edited at Module:No ping/doc.


Description

This module implements {{No ping}}. Its code was taken from the English Wikipedia.


-- This module implements {{noping}}.

local p = {}

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

function p._main(args)
	local ret = {}
	local fullUrl = mw.uri.fullUrl
	local format = string.format
	for i, username in ipairs(args) do
		local url = fullUrl(mw.site.namespaces.User.name .. ':' .. username)
		url = tostring(url)
		local label = args['label' .. tostring(i)]
		url = format('[%s %s]', url, label or username)
		ret[#ret + 1] = url
	end
	ret = mw.text.listToText(ret)
	ret = '<span class="plainlinks">' .. ret .. '</span>'
	return ret
end

return p