Module:Game

From Halo Esports Wiki
Jump to: navigation, search

Documentation for this module may be created at Module:Game/doc

return {
	game = function(frame) 
		local args = frame 
		if frame == mw.getCurrentFrame() then
			args = require( 'Module:ProcessArgs' ).merge( true )
		else
			frame = mw.getCurrentFrame()
		end
		local Gamenames = mw.loadData('Module:Gamenames')
	
		local gameInput = mw.ustring.lower(args[1] or '')
		local namevars = Gamenames[gameInput]
		
		if not namevars then
			namevars = {long = args[1], image = "ERROR"}
		elseif type(namevars) == 'string' then
			namevars = Gamenames[namevars]
		end
		
		local text = ''
		if args['text'] then
			text = namevars.long
		end
		local size = ''
		if args['size'] then
			size = args['size']
		end
		
		return '[[File:'..namevars.image..'|link=|'..size..']]'..text

	end
}