Module:PlayerGroup: Difference between revisions
Appearance
Content deleted Content added
Added module |
No edit summary |
||
| (One intermediate revision by one other user not shown) | |||
| Line 34: | Line 34: | ||
table.sort(roles) |
table.sort(roles) |
||
for i, role in ipairs(roles) do |
for i, role in ipairs(roles) do |
||
output = output |
output = output .. HF.trim(role) .. ' ,' |
||
end |
end |
||
| Line 43: | Line 43: | ||
return output |
return output |
||
end |
end |
||
end |
|||
function Infobox.PowerIcon( field, vars ) |
|||
output = field.Value |
|||
if not HF.isempty(field.PowerIcon) then |
|||
output = '[[File:' .. field.PowerIcon .. '|35px|link=]] [[' .. output .. ']]' |
|||
end |
|||
return output |
|||
end |
end |
||
Latest revision as of 07:48, 1 March 2020
Documentation for this module may be created at Module:PlayerGroup/doc
local Infobox = {}
local HF = require('Module:HF')
function Infobox.Link( field, vars )
output = ''
if not HF.isempty(field.Value) then
output = '[[' .. field.Value .. ']]'
return output
end
end
function Infobox.Allegiance( field, vars )
output = ''
if not HF.isempty(field.Value) then
if field.Value == "Alliance" then
output = '[[File:Alliance_vector.svg|27px|link=]] ' .. '[[' .. field.Value .. ']]'
elseif field.Value == "Empire" then
output = '[[File:Empire_vector.svg|27px|link=]] ' .. '[[' .. field.Value .. ']]'
elseif field.Value == "Federation" then
output = '[[File:Federation_vector.svg|27px|link=]] ' .. '[[' .. field.Value .. ']]'
elseif field.Value == "Independent" then
output = field.Value
else
output = '[[' .. field.Value .. ']]'
end
return output
end
end
function Infobox.GroupRoles( field, vars )
local output = ''
if not HF.isempty(field.Value) then
local roles = HF.explode(';', field.Value)
table.sort(roles)
for i, role in ipairs(roles) do
output = output .. HF.trim(role) .. ' ,'
end
if string.sub(output, -2) == ' ,' then
output = string.sub( output, 1, -3 )
end
return output
end
end
function Infobox.MainImage( field, vars )
output = ''
if not HF.isempty(field.Value) then
output = '[[File:' .. field.Value .. '|306px]]'
end
return output
end
return Infobox