Module:InfoboxPet: Difference between revisions

From Elwiki
No edit summary
No edit summary
 
Line 15: Line 15:
     infobox:addClass('infobox-pet');
     infobox:addClass('infobox-pet');


     addField('name');
     local fields = {
    addField('Starting Form');
        {
    addField('Inventory', 'Pet Inventory Size');
            id = 'name'
    addField('Trait');
        },
    addField('Commands', 'Special Commands');
        {
            id = 'Starting Form'
        },
        {
            id = 'Inventory',
            localize = 'Pet Inventory Size'
        },
        {
            id = 'Trait'
        },
        {
            id = 'Commands',
            localize = 'Special Commands'
        }
    }
 
    addFields(fields);


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

Latest revision as of 13:32, 8 September 2023

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