Module:InfoboxNPC: Difference between revisions

From Elwiki
No edit summary
No edit summary
Line 33: Line 33:
     addField('VA', 'Voice Actors', true);
     addField('VA', 'Voice Actors', true);
      
      
     return mw.allToString(infobox, clearfix);
     return tostring(infobox);


end
end


return p
return p

Revision as of 20:46, 10 May 2022

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

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

-- Main process
function p.main(frame)
    local args = getArgs(frame);
    local clearfix = mw.html.create('div'):addClass('clearfix');
    local title = '';

    if args.roleset then
        title = args.role1 .. '&' .. args.role2;
    else
        title = args.role;
    end

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

    if (args.name1 == nil and args.name2 == nil) then
        addField('name', 'Full Name');
    end
    addField2('name', 'Full Name');
    addField('class');
    addField('weapon', nil, true);
    addField('age', nil, true);
    addField('race', nil, true);
    addField('role', nil, true);
    addField('village', 'Location', true);
    addField('Height', nil, true);
    addField('Weight', nil, true);
    addField('Blood', 'Blood Type', true);
    addField('VA', 'Voice Actors', true);
    
    return tostring(infobox);

end

return p