Main | Documentation | Draft | Usage |
Module for {{Model Type}}. Uses data from Module:Model Type/data.
local p = {}
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {
parentFirst = true,
wrapper = { 'Template:Model Type' }
})
return p._main(args)
end
function p._main(args)
local pagename = args[1] or mw.title.getCurrentTitle().text
local nocat = args['nocat'] or false
local notext = args['notext'] or false
local nolink = args['nolink'] or false
local str_out = ''
if pagename == 'Traveler' then
if not notext then str_out = str_out .. 'Aether: ' end
str_out = str_out .. getBodyType('Aether', notext, nolink, nocat)
if not notext then str_out = str_out .. '<br/>Lumine: ' end
str_out = str_out .. getBodyType('Lumine', notext, nolink, nocat)
else
str_out = getBodyType(pagename, notext, nolink, nocat)
end
return str_out
end
function getBodyType(name, notext, nolink, nocat)
local btype = require('Module:Model Type/data')[name]
local str_out = ''
if btype ~= nil then
if not notext then
if nolink then
str_out = btype
else
str_out = '[[:Category:' .. btype .. ' Characters|' .. btype .. ']]'
end
end
if not nocat then
str_out = str_out .. require('Module:Namespace detect').main{['main']='[[Category:' .. btype .. ' Characters]]'}
end
end
return str_out
end
return p