Module:IconNav: Difference between revisions
From MENACE Official Wiki
Created page with "local p = {} function p.main(frame) local args = frame:getParent().args local icons = {} local links = {} -- Collect all icon/link pairs local i = 1 while args['icon' .. i] do table.insert(icons, args['icon' .. i]) table.insert(links, args['link' .. i]) i = i + 1 end -- Build icon row local iconRow = '| ' for j, icon in ipairs(icons) do if j > 1 then iconRow = iconRow .. ' || ' end..." |
No edit summary |
||
| Line 13: | Line 13: | ||
i = i + 1 | i = i + 1 | ||
end | end | ||
-- Get header parameters | |||
local headerText = args['header'] or 'Buildings' | |||
local leftImage = args['leftImage'] or 'laurels left.png' | |||
local rightImage = args['rightImage'] or 'laurels right.png' | |||
-- Build icon row | -- Build icon row | ||
| Line 30: | Line 35: | ||
-- Build table | -- Build table | ||
local result = '{| class="gridBG" align="center" style="background-color:#; width: 95%; height: 50px; border: 1px solid white; color: white; border-left: none; border-right: none; border-top: none;"\n' | local result = '{| class="gridBG" align="center" style="background-color:#; width: 95%; height: 50px; border: 1px solid white; color: white; border-left: none; border-right: none; border-top: none;"\n' | ||
result = result .. '| class="hides hidem" style="font-size: 125%; text-align: center;" | <center><big>[[File: | result = result .. '| class="hides hidem" style="font-size: 125%; text-align: center;" | <center><big>[[File:' .. leftImage .. '|15px|link=]] \'\'\'' .. headerText .. '\'\'\' [[File:' .. rightImage .. '|15px|link=]]</big></center>\n' | ||
result = result .. '|}\n' | result = result .. '|}\n' | ||
result = result .. '<center>\n' | result = result .. '<center>\n' | ||
Revision as of 13:55, 27 February 2026
Documentation for this module may be created at Module:IconNav/doc
local p = {}
function p.main(frame)
local args = frame:getParent().args
local icons = {}
local links = {}
-- Collect all icon/link pairs
local i = 1
while args['icon' .. i] do
table.insert(icons, args['icon' .. i])
table.insert(links, args['link' .. i])
i = i + 1
end
-- Get header parameters
local headerText = args['header'] or 'Buildings'
local leftImage = args['leftImage'] or 'laurels left.png'
local rightImage = args['rightImage'] or 'laurels right.png'
-- Build icon row
local iconRow = '| '
for j, icon in ipairs(icons) do
if j > 1 then iconRow = iconRow .. ' || ' end
iconRow = iconRow .. '[[File:' .. icon .. '.png|link=' .. links[j] .. '|124px]]'
end
-- Build link row
local linkRow = '| '
for j, link in ipairs(links) do
if j > 1 then linkRow = linkRow .. ' || ' end
linkRow = linkRow .. '[[' .. link .. ']]'
end
-- Build table
local result = '{| class="gridBG" align="center" style="background-color:#; width: 95%; height: 50px; border: 1px solid white; color: white; border-left: none; border-right: none; border-top: none;"\n'
result = result .. '| class="hides hidem" style="font-size: 125%; text-align: center;" | <center><big>[[File:' .. leftImage .. '|15px|link=]] \'\'\'' .. headerText .. '\'\'\' [[File:' .. rightImage .. '|15px|link=]]</big></center>\n'
result = result .. '|}\n'
result = result .. '<center>\n'
result = result .. '{| style="width: 95%; text-align: center;"\n'
result = result .. '|-\n'
result = result .. '| style="height: 20px;" |\n'
result = result .. '|-\n'
result = result .. iconRow .. '\n'
result = result .. '|-\n'
result = result .. linkRow .. '\n'
result = result .. '|}\n'
result = result .. '</center>'
return result
end
return p


