Module:TV: Difference between revisions
From Terra Invicta Official Wiki
No edit summary |
No edit summary |
||
| Line 7: | Line 7: | ||
local slower = string.lower | local slower = string.lower | ||
local spanSettings = '<span style="border: 2px solid powderblue; border-radius: 7px; padding: 0px 4px 2px; background-color: black; color: white;">' | |||
function p.VT( frame ) | function p.VT( frame ) | ||
| Line 17: | Line 18: | ||
VTtype = slower(VTtype) | VTtype = slower(VTtype) | ||
VTtype = mw.text.trim(VTtype) | VTtype = mw.text.trim(VTtype) | ||
local returnString = VTvalue .. ' ' .. VTData[VTtype][1] | local returnString = spanSettings .. VTvalue .. ' ' .. VTData[VTtype][1] | ||
if VTshort ~= 'true' then | if VTshort ~= 'true' then | ||
returnString = returnString .. VTData[VTtype][2] | returnString = returnString .. VTData[VTtype][2] | ||
end | end | ||
returnString = returnString .. '</span>' | |||
return returnString | return returnString | ||
end | end | ||
return p | return p | ||
Revision as of 20:18, 2 January 2026
Documentation for this module may be created at Module:TV/doc
-- This is a LUA version of the Template:VT page.
-- The idea is to standardize how Value-Type pairs are presented.
local p = {}
local VTData = mw.loadData('Module:VT/data')
local slower = string.lower
local spanSettings = '<span style="border: 2px solid powderblue; border-radius: 7px; padding: 0px 4px 2px; background-color: black; color: white;">'
function p.VT( frame )
local VTvalue = frame.args[1]
local VTtype = frame.args[2]
local VTshort = frame.args[3]
if not VTtype then
return 'ERROR: No type specified for VT Module'
end
VTtype = slower(VTtype)
VTtype = mw.text.trim(VTtype)
local returnString = spanSettings .. VTvalue .. ' ' .. VTData[VTtype][1]
if VTshort ~= 'true' then
returnString = returnString .. VTData[VTtype][2]
end
returnString = returnString .. '</span>'
return returnString
end
return p


