Module:InfoboxPet: Difference between revisions
From Elwiki
(Created page with "require('Module:CommonFunctions') local getArgs = require('Module:Arguments').getArgs local p = {} -- Main process function p.main(frame) local args = getArgs(frame);...") |
No edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
function p.main(frame) | function p.main(frame) | ||
local args = getArgs(frame); | local args = getArgs(frame); | ||
if args['Icon'] == nil then | if args['Icon'] == nil then | ||
args['Icon'] = 'Dunno.png'; | args['Icon'] = frame:preprocess('[[File:Dunno.png|48px]]'); | ||
end | end | ||
local title = args['Icon'] .. ' ' .. args['Name']; | local title = args['Icon'] .. ' ' .. args['Name']; | ||
local infobox = require('Module:InfoboxProto').main(frame, title); | local infobox = require('Module:InfoboxProto').main(frame, title); | ||
infobox:addClass('infobox- | 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]]'; | 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