Leaguepedia | League of Legends Esports Wiki
Advertisement
Leaguepedia | League of Legends Esports Wiki

To edit the documentation or categories for this module, click here.


local p = {}

function p.region( frame )
	local args = frame 
	if frame == mw.getCurrentFrame() then
		args = require( 'Module:ProcessArgs' ).merge( true )
	else
		frame = mw.getCurrentFrame()
	end
	
	local text = ''
	local regionnames = mw.loadData('Module:Regionnames')
	local regionstyles = mw.loadData('Module:Regionstyles')
	
	local regioninput = mw.ustring.lower(args[1] or '')
	
	
	local namevars = regionnames[regioninput]
	local logo = ""

	if not namevars then
		namevars = {long = args[1], medium = args[1], short = args['short'] or args[1] }
	elseif type(namevars) == 'string' then
		namevars = regionnames[namevars]
		logo = namevars.link:gsub("+", " ")
	else
		logo = namevars.link:gsub("+", " ")
	end
	
	text = regionstyles[args['2'] or 'default']
	
	return text:gsub("REPLACE(%u+)", { ["LONG"] = namevars.long, ["MEDIUM"] = namevars.medium, ["SHORT"] = namevars.short})
	
	
end

return p