Module:InfoboxPet: Difference between revisions

From Elwiki
No edit summary
No edit summary
Line 8: Line 8:


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


Line 22: Line 21:
     addField('Commands', 'Special Commands');
     addField('Commands', 'Special Commands');


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


end
end


return p
return p

Revision as of 12:41, 29 April 2022

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'] = '[[File:Dunno.png|48px]]';
    end
    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