Marvel Cinematic Universe Wiki

Should LEGO Marvel's Avengers and browser games be covered on the wiki? Share your thoughts!

READ MORE

Marvel Cinematic Universe Wiki
Marvel Cinematic Universe Wiki
Marvel Cinematic Universe Wiki
39,257
pages

This is a citizenship module that takes an argument, looks it up in a dictionary if it exists, and then returns the value.


local p = {}

local citizenshipData = mw.loadData('Module:Citizenship/data')

local noArgMsg = '<span style="color: #ff0000">no argument was provided</span>'
local invalidArgMsg = '<span style="color: #ff0000">invalid argument provided</span>'

p.citizenship = function(frame)
	local args = frame:getParent().args
	if args[1] == nil then
		return noArgMsg .. '[[Category:Pages with script errors]]'
	elseif citizenshipData[args[1]] == nil then
		return invalidArgMsg .. '[[Category:Pages with script errors]]'
	end
    return citizenshipData[args[1]]
end

return p