Jump to content

Module:StationInfobox: Difference between revisions

From Elite Dangerous Wiki
Content deleted Content added
m Testing
m Testing
Line 4: Line 4:
local lang = mw.language.new('en')
local lang = mw.language.new('en')


--local stations = mw.loadData( 'Module:FooBar/stations' )
local stations = {
["orbis"] = "[[File:OrbisStation_001.jpg|285px]]",
["ocellus"] = "[[File:OcellusStation_001.jpg|285px]]",
["coriolis"] = "[[File:CoriolisStation_001.jpg|285px]]",
["outpost"] = "[[File:Outpost_001.jpg|285px]]",
}


function Infobox.Quantify( field, vars )
function Infobox.Quantify( field, vars )
Line 19: Line 24:
local output = ''
local output = ''
local station = field.Station
local station = field.Station
if HF.isempty(field.Value) then
if HF.isempty(field.Value) and stations[station] ~= nil then
--output = stations[station]
output = stations[station]
return output
return output
else
else

Revision as of 12:51, 26 May 2015

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

local Infobox = {}
local HF = require('Module:HF')

local lang = mw.language.new('en')

local stations = {
	["orbis"] = "[[File:OrbisStation_001.jpg|285px]]",
	["ocellus"] = "[[File:OcellusStation_001.jpg|285px]]",
	["coriolis"] = "[[File:CoriolisStation_001.jpg|285px]]",
	["outpost"] = "[[File:Outpost_001.jpg|285px]]",
}

function Infobox.Quantify( field, vars )
    local unit = field.Unit or ''
    local value = field.Value or field.Default or '?'
    if HF.isempty(value) then 
        return '---'
    else
        return value .. ' ' .. unit
    end
end

function Infobox.MainImage( field, vars )
    local output = ''
    local station = field.Station
    if HF.isempty(field.Value) and stations[station] ~= nil then
        output = stations[station]
        return output
    else
        output = "[[File:" .. field.Value .. "|285px]]"
        return output
    end
end

return Infobox