-- In the webtoon, Magician ranks and rankings change periodically,
-- such as when a character is promoted or dies.
-- This module should ease the process of updating 30+ character pages
-- whenever a change occurs.
local p = {}
local magiciandat = mw.loadData( 'Module:MagicianRank/magiciandat' )
-- This produces for a given character one of the following:
--    'true' if overall rank in N15 = overall rank in N16
--    magic rank in N15
--    overall rank in N15
--    magic rank in N16
--    overall rank in N16
function p.mData( frame )
	local charName   = frame.args[1]
	local outputType = frame.args[2]
	local outputTxt  = nil
	if (magiciandat[charName]) ~= nil then  -- Check if the key charName exists.
		local mRank16    = magiciandat[charName].magic_rank_N16
		local mRanking16 = magiciandat[charName].magic_ranking_N16
		local mRank15    = magiciandat[charName].magic_rank_N15
		local mRanking15 = magiciandat[charName].magic_ranking_N15
		if mRanking16 == '' then mRanking16 = '?' end
		if mRanking15 == '' then mRanking15 = '?' end
		if (outputType == 'infobox') then
			if (mRanking16 == mRanking15) then outputTxt = 'true'
			else outputTxt = 'false'
		elseif (outputType == 'rank16') then outputTxt = mRank16
		elseif (outputType == 'ranking16') then outputTxt = mRanking16
		elseif (outputType == 'rank15') then outputTxt = mRank15
		elseif (outputType == 'ranking15') then outputTxt = mRanking15
	return outputTxt
return p
--[[Category:Lua modules]]

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.