Module:FeaturedUnit

local p = {}

function p._featuredUnit(iname) if not iname then return 'No unit specified' end local model = require('Module:Data').model local unit = model.query('Unit','_pageName,server,rare,img,iname',{where='iname="'..iname..'"'})[1] or {} if not unit.iname then return ('Invalid unit '..iname.. ' requested') end

local output = {} local render_unit = require('Module:Render/Unit')

table.insert(output, ' ') table.insert(output, ' ' .. render_unit._icon({unit.iname, data=unit, name='none', size='large'}) .. ' ') table.insert(output, ' ' .. render_unit._pageName({unit.iname, data=unit}) .. ' ')

local unitExtraData = mw.loadData("Module:Data/Extra/Unit")[unit.iname] or {}

if unitExtraData['source'] then table.insert(output, unitExtraData['source']) end

if unitExtraData['glDate'] then table.insert(output, unitExtraData['glDate']) end

table.insert(output, ' ') return table.concat(output, "\n\n") end

function p.featuredUnit(frame) local args = require('Module:Arguments').getArgs(frame, {       parentFirst = true,    }) return p._featuredUnit(args[1]) or 'No unit specified' end

return p