Module:Shiren 6 Dungeon Traps table: Difference between revisions
Jump to navigation
Jump to search
(Created page with "-------------------------------------------------------------------------------- -- -- Module:Shiren 6 Dungeon Traps table -- -------------------------------------------------------------------------------- local p = {} local mw = require('mw') function p.main(frame) local args = frame.args local output = {} -- Header row table.insert(output, '<table class="templateTheme" style="text-align: center; margin: auto; width: 50%;">') table.insert(output, '<tr>') tabl...") |
mNo edit summary |
||
Line 33: | Line 33: | ||
table.insert(rowData, '<th class="templatePrimary">[[File:Shiren 6 - ' .. (trapArg or "") .. '.png]]</th>') | table.insert(rowData, '<th class="templatePrimary">[[File:Shiren 6 - ' .. (trapArg or "") .. '.png]]</th>') | ||
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Shiren6", args = {(trapArg or "")}} .. '</td>') | table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Shiren6", args = {(trapArg or "")}} .. '</td>') | ||
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Shiren | table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Shiren 6 Trap Data Cell|shiren3TrapDataCell|name=' .. (trapArg or "") .. '}}') .. '</td>') | ||
table.insert(rowData, '<td class="templateSecondary">' .. (floorArg or frame:expandTemplate{title = "Research"}) .. '</td>') | table.insert(rowData, '<td class="templateSecondary">' .. (floorArg or frame:expandTemplate{title = "Research"}) .. '</td>') | ||
table.insert(rowData, '</tr>') | table.insert(rowData, '</tr>') |
Revision as of 20:50, 25 February 2024
Documentation for this module may be created at Module:Shiren 6 Dungeon Traps table/doc
--------------------------------------------------------------------------------
--
-- Module:Shiren 6 Dungeon Traps table
--
--------------------------------------------------------------------------------
local p = {}
local mw = require('mw')
function p.main(frame)
local args = frame.args
local output = {}
-- Header row
table.insert(output, '<table class="templateTheme" style="text-align: center; margin: auto; width: 50%;">')
table.insert(output, '<tr>')
table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">Model</th>')
table.insert(output, '<th class="templatePrimary" colspan="2">' .. frame:expandTemplate{title = "Shiren6", args = {"Traps and Floor Tiles"}} .. '</th>')
table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 40%;">Floors</th>')
table.insert(output, '</tr>')
table.insert(output, '<tr>')
table.insert(output, '<th class="templatePrimary" style="width: 25%;">English</th>')
table.insert(output, '<th class="templatePrimary" style="width: 25%;">Japanese</th>')
table.insert(output, '</tr>')
-- Data rows
for i = 1, 100 do
local trapArg = args["trap_" .. i]
local floorArg = args["floor_" .. i]
if not trapArg and not floorArg then
break -- exit loop when no more rows are found
end
local rowData = {}
table.insert(rowData, '<tr class="trapsTableRow">')
table.insert(rowData, '<th class="templatePrimary">[[File:Shiren 6 - ' .. (trapArg or "") .. '.png]]</th>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Shiren6", args = {(trapArg or "")}} .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Shiren 6 Trap Data Cell|shiren3TrapDataCell|name=' .. (trapArg or "") .. '}}') .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. (floorArg or frame:expandTemplate{title = "Research"}) .. '</td>')
table.insert(rowData, '</tr>')
table.insert(output, table.concat(rowData))
end
table.insert(output, '</table>')
return table.concat(output)
end
return p