Module:Status

local p = {} local h = {}

local data = mw.loadData('Module:Data/Status')

function p.main(frame) local args = require('Dev:Arguments').getArgs(frame, {parentFirst=true}) return p._main(args) end

function p._main(args) local key = args.Name or args[1] -- if not key then return end -- bad input local obj = data[key] if not obj then return end -- missing data local t = { ' ',       '{| style="background-color:#140d0d; color:#D5D4D4; border: 1px solid #333; margin:left;"', '|-',       '! colspan=3 style="max-width:100px; background-color:#990000;"| Name', '| colspan=5 style="text-align:center;"| ' .. obj.Name .. '', '|- style="background-color:#900"', '! Icon !! Duration !! Type !! Effect', '|-',       '| ' .. h.icon{obj.Name, 'Status', Align='center'}, '| ' .. obj.Duration .. ' ',       '| ' .. obj.Type .. ' ',       '| ' .. obj.Effect .. ' ',   	'|-',        '! colspan=3 style="max-width:100px; background-color:#990000;"| Notes ', '| colspan=5 style="text-align:center;"|' .. obj.Notes, '|}',       ' ',    }    return table.concat(t, '\n') end

function h.icon(args) local name = args[1] local status = args[2] local align = args.Align return (''):format(name, align, name, name, status) end

return p