Module:InfoboxPet

From Elwiki
Revision as of 12:32, 8 September 2023 by Ritsu (talk | contribs)
(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['Icon'] == nil then
        args['Icon'] = frame:preprocess('[[File:Dunno.png|48px]]');
    end
    local title = args['Icon'] .. ' ' .. args['Name'];

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

    local fields = {
        {
            id = 'name'
        },
        {
            id = 'Starting Form'
        },
        {
            id = 'Inventory',
            localize = 'Pet Inventory Size'
        },
        {
            id = 'Trait'
        },
        {
            id = 'Commands',
            localize = 'Special Commands'
        }
    }

    addFields(fields);

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

end

return p