Module:Sandbox/MjolnirPants explained

local getArgs = require('Module:Arguments').getArgsp =

--Hurls a randomly generated, nonsensical insult.--Invoke using:--p.NonsenseNameCaller = function --set up the syntax local syntaxes = local syntaxMax = 5 --set up the adjective local adjectives = local adjMax = 5 --set up the noun local nouns = local nounMax = 5 --pick the three elements local seed = math.floor(os.time) math.randomseed(seed) local syntax = syntaxes[math.random(syntaxMax)] local adjective = adjectives[math.random(adjMax)] local noun = nouns[math.random(nounMax)] --make the insult local insult = string.gsub(syntax, "_1_", adjective) insult = string.gsub(insult, "_2_", noun) return insultend

p.GraphSelector = function --initialize the random number genny local seed = math.floor(os.time) math.randomseed(seed) --Get the X and Y offsets local xOffset = math.random(10) * 250 local yOffset = math.random(10) * 250 --Concatenate the string and return it local resString = "" return resStringend

p.GraphPickerX = function local seed = math.floor(os.time) math.randomseed(seed) --Get the X and Y offsets local xOffset = math.random(0, 9) * 250 return xOffsetend

p.GraphPickerY = function local seed = math.floor(os.time) + 1 -- just to be sure math.randomseed(seed) --Get the X and Y offsets local yOffset = math.random(0, 9) * 250 return yOffsetend

function p.test(frame) local pgCont = mw.title.new("User:MjolnirPants/Voices"):getContent return pgContend

function p.PingRFCUsers(frame) local args = getArgs(frame) return p._PingRFCUsers(args)end

function p._PingRFCUsers(args) local pageSource = "" --check the size of the arguments array --if there's more than one, the second one --should be the name of the page on which --to find the discussion if args[2] then --get the title from the second argument pageSource = mw.title.new(args[2]):getContent flag = 1 else --If no second parameter was passed, then --the discussion is on the current page pageSource = mw.title.getCurrentTitle:getContent flag = 2 end local users = local ii = 1 local i, j = string.find(pageSource, "

" .. args[1]) pageSource = string.sub(pageSource, i + string.len(args[1]) + 4) i, j = string.find(pageSource, "

") pageSource = string.sub(pageSource, 1, i - 1) i, j = string.find(pageSource, "%[%[User:") local uName = "" local k, l, m, n = i + 1 local cat = "Pinging participants of [[#" .. args[1] .."|previous RfC]]: ~~~~" -- local ret = "" --return pageSource.. "\r\nusers:" .. cat .. "\r\ni:" .. i .. " j:" .. j .. " k:" .. k .. " l:" .. l .. " m:" .. m .. " n:" .. n return cat --return "\r\n" .. mw.title.new(args[2]):getContentend

return p