Module:RoleInfobox: Difference between revisions
Appearance
Content deleted Content added
Initial creating |
m Corrected spelling/grammar |
||
| Line 14: | Line 14: | ||
if not HF.isempty(field.Value) then |
if not HF.isempty(field.Value) then |
||
local ships = HF.explode('; ', field.Value) |
local ships = HF.explode('; ', field.Value) |
||
table.sort(ships) |
|||
for i, ship in ipairs(ships) do |
for i, ship in ipairs(ships) do |
||
output = output .. '[[' .. ship .. ']] ' |
output = output .. '[[' .. ship .. ']] ' |
||
| Line 29: | Line 29: | ||
if not HF.isempty(field.Value) then |
if not HF.isempty(field.Value) then |
||
local upgrades = HF.explode('; ', field.Value) |
local upgrades = HF.explode('; ', field.Value) |
||
table.sort(upgrades) |
|||
for i, upgrade in ipairs(upgrades) do |
for i, upgrade in ipairs(upgrades) do |
||
output = output .. '[[' .. upgrade .. ']] ' |
output = output .. '[[' .. upgrade .. ']] ' |
||
Revision as of 12:41, 25 May 2015
Documentation for this module may be created at Module:RoleInfobox/doc
local Infobox = {}
local HF = require('Module:HF')
function Infobox.MainImage( field, vars )
local output = field.Value
if not HF.isempty(output) then
output = '[[File:' .. output .. '|250px]]'
return output
end
end
function Infobox.Ships( field, vars )
local output = ''
if not HF.isempty(field.Value) then
local ships = HF.explode('; ', field.Value)
table.sort(ships)
for i, ship in ipairs(ships) do
output = output .. '[[' .. ship .. ']] '
end
-- Remove last space
output = HF.trim(output)
return output
end
end
function Infobox.Upgrades( field, vars )
local output = ''
if not HF.isempty(field.Value) then
local upgrades = HF.explode('; ', field.Value)
table.sort(upgrades)
for i, upgrade in ipairs(upgrades) do
output = output .. '[[' .. upgrade .. ']] '
end
-- Remove last space
output = HF.trim(output)
return output
end
end
return Infobox