Module:ping user

Hello, you have come here looking for the meaning of the word Module:ping user. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:ping user, but we will also tell you about its etymology, its characteristics and you will know how to say Module:ping user in singular and plural. Everything you need to know about the word Module:ping user you have here. The definition of the word Module:ping user will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:ping user, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

Module for {{u}}, {{ping}}, and {{reply to}}


local export = {}

local match = string.match

local function link(username, link_text)
	if type(username) ~= "string" then
		error('The function "link" requires a string argument.')
	end

	local namespace = match(username, "^(.+):")
	local userpage
	if namespace and namespace ~= "User" then
		if match(username, "^%x%x?%x?%x?:%x%x?%x?%x?:%x%x?%x?%x?:%x%x?%x?%x?:%x%x?%x?%x?:%x%x?%x?%x?:%x%x?%x?%x?:%x%x?%x?%x?$") then
			userpage = username
		else
			error('The username "' .. username .. '" contains the incorrect namespace "' .. tostring(namespace) .. '".')
		end
	else
		userpage = match(username, ":(.+)$") or username
	end

	if not link_text then
		link_text = userpage
	end

	return "]"
end

function export.reply_to(frame)
	local params = {
		 = { list = true, allow_holes = true },
		 = { list = true, allow_holes = true },
		 = { allow_empty = true },
	}

	local args = require("Module:parameters").process(frame:getParent().args, params)
	local usernames = args
	local link_text = args
	local prefix = "@"
	local postfix = args.p or ":"
	local namespace = mw.title.getCurrentTitle().nsText

	local output = {}

	if #usernames == 0 then
		if namespace == "Template" then
			usernames = { "Example~enwiktionary", maxindex = 1 }
		else
			error("Error in replyto template: Username not given.")
		end
	end

	for i = 1, math.max(usernames.maxindex, link_text.maxindex) do
		table.insert(output, link(usernames, link_text))
	end

	output = prefix .. table.concat(output, ", ") .. postfix

	return output
end

function export.ping(frame)
	local params = {
		 = { list = true, allow_holes = true },
		 = { list = true, allow_holes = true },
		 = { allow_empty = true },
		 = { allow_empty = true },

	}

	local args = require("Module:parameters").process(frame:getParent().args, params)
	local usernames = args
	local link_text = args
	local prefix = args or "@"
	local postfix = args.p
	local namespace = mw.title.getCurrentTitle().nsText

	local output = {}

	if #usernames == 0 then
		if namespace == "Template" then
			usernames = { "Example~enwiktionary", maxindex = 1 }
		else
			error("Error in replyto template: Username not given.")
		end
	end

	for i = 1, math.max(usernames.maxindex, link_text.maxindex) do
		table.insert(output, link(usernames, link_text))
	end

	output = prefix .. table.concat(output, ", ")

	return output
end

function export.link(frame)
	local params = {
		 = { list = true, allow_holes = true },
		 = { list = true, allow_holes = true },
	}

	local args = require("Module:parameters").process(frame:getParent().args, params)
	local usernames = args
	local link_text = args
	local namespace = mw.title.getCurrentTitle().nsText

	local output = {}

	if #usernames == 0 then
		if namespace == "Template" then
			usernames = { "Example~enwiktionary", maxindex = 1 }
		else
			error("Error in replyto template: Username not given.")
		end
	end

	for i = 1, math.max(usernames.maxindex, link_text.maxindex) do
		table.insert(output, link(usernames, link_text))
	end

	output = table.concat(output, ", ")

	return output
end

return export