Module:Citizenship

This module pulls in from a list of country codes to determine character nationality.


local p = {}

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

local noArgMsg = '<span style="color: #ff0000">No argument 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