Module:Unit icon

From Sekaipedia

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

local getArgs = require('Module:Arguments').getArgs
local yesno   = require('Module:Yesno')
local data    = mw.loadData('Module:Unit icon/data')

local p = {}

function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end

function p._main(args)
	local unit = string.lower(args[1] or '')
	local size = args['size'] or '30px'
	local shouldLink = yesno(args['link'], false)

	local icons = data.icons
	local links = data.links
	
	if icons[unit] then
		local link = ''
		
		if shouldLink then
			link = links[unit] or ''
		end
		
		return string.format('[[File:%s|x%s|link=%s]]', icons[unit], size, link)
	end
	
	return nil
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.