Module:HabModuleSpecial: Difference between revisions
From Terra Invicta Official Wiki
Created page with "-- This is a LUA version of the Template:HabModuleSpecial page. local p = {} local IconModule = require('Module:Icon') local hmsData = mw.loadData( 'Module:HabModuleSpecial/data' ) function p.hms( frame ) local hmsName = frame.args[1] if not hmsName or not hmsData[hmsName] then return 'No such Hab Module Special' end local valueString = '' if frame.args['specialRulesValue'] and frame.args['specialRulesValue'] ~= '' then valueString..." |
No edit summary |
||
| Line 11: | Line 11: | ||
return 'No such Hab Module Special' | return 'No such Hab Module Special' | ||
end | end | ||
-- hmsData[hmsName][1] is the text before the value. | |||
-- hmsData[hmsName][2] is the text after the value. | |||
-- hmsData[hmsName][3] is the value type to insert. | |||
if not hmsData[hmsName][3] then | |||
elseif | return hmsData[hmsName][1] | ||
elseif hmsData[hmsName][3] == 'specialRulesValue' then | |||
elseif | return hmsData[hmsName][1] .. frame.args['specialRulesValue'] .. hmsData[hmsName][2] | ||
elseif hmsData[hmsName][3] == 'specialRulesValue%' then | |||
elseif | return hmsData[hmsName][1] .. tostring(tonumber(frame.args['specialRulesValue']) * 100) .. '%' .. hmsData[hmsName][2] | ||
elseif hmsData[hmsName][3] == 'constructionTimeModifier' then | |||
return hmsData[hmsName][1] .. frame.args['constructionTimeModifier'] .. hmsData[hmsName][2] | |||
elseif hmsData[hmsName][3] == 'controlPointCapacity' then | |||
return hmsData[hmsName][1] .. frame.args['controlPointCapacity'] .. hmsData[hmsName][2] | |||
elseif hmsData[hmsName][3] == 'techBonus' then | |||
local techBonus = tostring(tonumber(frame.args['techBonus']) * 100) .. '%' | |||
local techCat = frame.args['techCat'] | local techCat = frame.args['techCat'] | ||
return hmsData[hmsName][1] .. techBonus .. IconModule.Icon({args={techCat}}) .. techCat .. hmsData[hmsName][2] | |||
end | end | ||
return 'ERROR, this should never appear.' | |||
end | end | ||
return p | return p | ||
Revision as of 03:07, 22 September 2025
Documentation for this module may be created at Module:HabModuleSpecial/doc
-- This is a LUA version of the Template:HabModuleSpecial page.
local p = {}
local IconModule = require('Module:Icon')
local hmsData = mw.loadData( 'Module:HabModuleSpecial/data' )
function p.hms( frame )
local hmsName = frame.args[1]
if not hmsName or not hmsData[hmsName] then
return 'No such Hab Module Special'
end
-- hmsData[hmsName][1] is the text before the value.
-- hmsData[hmsName][2] is the text after the value.
-- hmsData[hmsName][3] is the value type to insert.
if not hmsData[hmsName][3] then
return hmsData[hmsName][1]
elseif hmsData[hmsName][3] == 'specialRulesValue' then
return hmsData[hmsName][1] .. frame.args['specialRulesValue'] .. hmsData[hmsName][2]
elseif hmsData[hmsName][3] == 'specialRulesValue%' then
return hmsData[hmsName][1] .. tostring(tonumber(frame.args['specialRulesValue']) * 100) .. '%' .. hmsData[hmsName][2]
elseif hmsData[hmsName][3] == 'constructionTimeModifier' then
return hmsData[hmsName][1] .. frame.args['constructionTimeModifier'] .. hmsData[hmsName][2]
elseif hmsData[hmsName][3] == 'controlPointCapacity' then
return hmsData[hmsName][1] .. frame.args['controlPointCapacity'] .. hmsData[hmsName][2]
elseif hmsData[hmsName][3] == 'techBonus' then
local techBonus = tostring(tonumber(frame.args['techBonus']) * 100) .. '%'
local techCat = frame.args['techCat']
return hmsData[hmsName][1] .. techBonus .. IconModule.Icon({args={techCat}}) .. techCat .. hmsData[hmsName][2]
end
return 'ERROR, this should never appear.'
end
return p


