Module:Torneko 1 Dungeon Monsters table: Difference between revisions
Jump to navigation
Jump to search
(Created page with "-------------------------------------------------------------------------------- -- -- Module:Torneko 1 Dungeon Monsters 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>')...") |
mNo edit summary |
||
Line 25: | Line 25: | ||
-- Data rows | -- Data rows | ||
for i = 1, 100 do | for i = 1, 100 do | ||
local monsterArg = | local monsterArg = args["monster_" .. i] | ||
local | local floorArg = args["floors_" .. i] | ||
if not monsterArg and not floorArg then | if not monsterArg and not floorArg then | ||
break -- exit loop when no more rows are found | break -- exit loop when no more rows are found | ||
end | end | ||
monsterArg = (monsterArg or "") | |||
floorArg = (floorArg or frame:expandTemplate{title = "Research"}) | |||
local rowData = {} | local rowData = {} | ||
table.insert(rowData, '<tr class="monstersTableRow">') | table.insert(rowData, '<tr class="monstersTableRow">') | ||
table.insert(rowData, '<th class="templatePrimary">' .. frame:expandTemplate{title = "Torneko1Sprite", args = { | table.insert(rowData, '<th class="templatePrimary">' .. frame:expandTemplate{title = "Torneko1Sprite", args = {monsterArg}} .. '</th>') | ||
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Torneko1", args = {monsterArg}} .. '</td>') | table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Torneko1", args = {monsterArg}} .. '</td>') | ||
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Torneko 1 Monster Data Cell|torneko1MonsterDataCell|name=' .. monsterArg .. '|getVar=ja}}') .. '</td>') | table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Torneko 1 Monster Data Cell|torneko1MonsterDataCell|name=' .. monsterArg .. '|getVar=ja}}') .. '</td>') |
Revision as of 11:28, 28 January 2024
--------------------------------------------------------------------------------
--
-- Module:Torneko 1 Dungeon Monsters 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%;">Sprite</th>')
table.insert(output, '<th class="templatePrimary" colspan="2">' .. frame:expandTemplate{title = "Torneko1", args = {"Monsters"}} .. '</th>')
table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 20%;">' .. frame:expandTemplate{title = "Torneko1", args = {"Experience"}} .. '</th>')
table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 20%;">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 monsterArg = args["monster_" .. i]
local floorArg = args["floors_" .. i]
if not monsterArg and not floorArg then
break -- exit loop when no more rows are found
end
monsterArg = (monsterArg or "")
floorArg = (floorArg or frame:expandTemplate{title = "Research"})
local rowData = {}
table.insert(rowData, '<tr class="monstersTableRow">')
table.insert(rowData, '<th class="templatePrimary">' .. frame:expandTemplate{title = "Torneko1Sprite", args = {monsterArg}} .. '</th>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Torneko1", args = {monsterArg}} .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Torneko 1 Monster Data Cell|torneko1MonsterDataCell|name=' .. monsterArg .. '|getVar=ja}}') .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Torneko 1 Monster Data Cell|torneko1MonsterDataCell|name=' .. monsterArg .. '|getVar=exp}}') .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. floorArg .. '</td>')
table.insert(rowData, '</tr>')
table.insert(output, table.concat(rowData))
end
table.insert(output, '</table>')
return table.concat(output)
end
return p