Module:InfoboxPet

From Elwiki
Revision as of 12:35, 29 April 2022 by Ritsu (talk | contribs) (Created page with "require('Module:CommonFunctions') local getArgs = require('Module:Arguments').getArgs local p = {} -- Main process function p.main(frame) local args = getArgs(frame);...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

require('Module:CommonFunctions')
local getArgs = require('Module:Arguments').getArgs
local p = {}

-- Main process
function p.main(frame)
    local args = getArgs(frame);

    if args.color == nil then
        args.color = '{{ColorSel|Misc}}';
    end

    if args['Icon'] == nil then
        args['Icon'] = 'Dunno.png';
    end
    args['Icon'] = '[[File:' .. args['Icon'] .. '|48px]]';
    local title = args['Icon'] .. ' ' .. args['Name'];

    local infobox = require('Module:InfoboxProto').main(frame, title);
    infobox:addClass('infobox-npc');

    addField('name');
    addField('Starting Form');
    addField('Inventory', 'Pet Inventory Size');
    addField('Trait');
    addField('Commands', 'Special Commands');

    return tostring(infobox) .. '[[Category: Pets]]';

end

return p