NBA 2K Esports Wiki
Advertisement

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


local p = {}

function p.teamImage ( frame )
	local args = frame 
	if frame == mw.getCurrentFrame() then
		args = require( 'Module:ProcessArgs').norm()
	else
		frame = mw.getCurrentFrame()
	end
	
	local tnames = mw.loadData( 'Module:Teamnames' )
	local userinput = args[1] or ''
	local size = args['size'] or '123px'
	local namevars = tnames[mw.ustring.lower( userinput )]
	local logo = ''
	
	if not namevars then
		link = ''
	elseif type(namevars) == 'string' then
		namevars = tnames[namevars]
		logo = namevars.link:gsub("+", " ")
		link = namevars.link
	else
		logo = namevars.link:gsub("+", " ")
		link = namevars.link
	end
	
	local text = '[[File:' .. logo .. 'logo square.png|' .. size .. '|link=' .. link ..']]'
	return text
end

return p
Advertisement