Template:Sandbox: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | -- | ||
-- Module:Rescue Team DX | -- Module:Rescue Team DX Pokémon Locations table | ||
-- | -- | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
Line 19: | Line 19: | ||
table.insert(output, '<th colspan="1" class="templatePrimary" style="width: 15%;">Method</th>') | table.insert(output, '<th colspan="1" class="templatePrimary" style="width: 15%;">Method</th>') | ||
table.insert(output, '<th colspan="1" class="templatePrimary" style="width: 15%;">Spawn Rate</th>') | table.insert(output, '<th colspan="1" class="templatePrimary" style="width: 15%;">Spawn Rate</th>') | ||
table.insert(output, '</tr>') | table.insert(output, '</tr>') | ||
-- Data rows | -- Data rows | ||
for i = 1, 100 do | for i = 1, 100 do | ||
local | local locationArg = args["location_" .. i] | ||
local | local floorsArg = args["floors_" .. i] | ||
if not | local levelsArg = args["levels_" .. i] | ||
local methodArg = args["method_" .. i] | |||
local spawnArg = args["spawnrate_" .. i] | |||
if not locationArg and not floorsArg and not levelsArg and not methodArg and not spawnArg then | |||
break -- exit loop when no more rows are found | break -- exit loop when no more rows are found | ||
end | end | ||
local rowData = {} | local rowData = {} | ||
table.insert(rowData, '<tr class="itemsTableRow">') | table.insert(rowData, '<tr class="itemsTableRow">') | ||
if | if locationArg then | ||
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeamDX", args = {moveArg}} .. '</td>') | table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeamDX", args = {moveArg}} .. '</td>') | ||
else | else | ||
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Research"} .. '</td>') | table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Research"} .. '</td>') | ||
Line 43: | Line 40: | ||
end | end | ||
table.insert(rowData, '<td class="templateSecondary">' .. (levelArg or frame:expandTemplate{title = "Research"}) .. '</td>') | table.insert(rowData, '<td class="templateSecondary">' .. (levelArg or frame:expandTemplate{title = "Research"}) .. '</td>') | ||
end | end | ||
table.insert(rowData, '</tr>') | table.insert(rowData, '</tr>') |
Revision as of 05:04, 23 October 2023
-- -- Module:Rescue Team DX Pokémon Locations table --
local p = {} local mw = require('mw')
function p.main(frame) local args = frame.args local output = {} -- Header row
table.insert(output, '
') table.insert(output, '') table.insert(output, '') table.insert(output, '') table.insert(output, '') table.insert(output, '') table.insert(output, '') table.insert(output, '') -- Data rows for i = 1, 100 do local locationArg = args["location_" .. i] local floorsArg = args["floors_" .. i] local levelsArg = args["levels_" .. i] local methodArg = args["method_" .. i] local spawnArg = args["spawnrate_" .. i] if not locationArg and not floorsArg and not levelsArg and not methodArg and not spawnArg then break -- exit loop when no more rows are found end local rowData = {} table.insert(rowData, '') if locationArg then table.insert(rowData, '')else
table.insert(rowData, '') table.insert(rowData, '') table.insert(rowData, '')end
table.insert(rowData, '')end
table.insert(rowData, '') table.insert(output, table.concat(rowData)) end table.insert(output, 'Location | Floors | ' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Levels"}} .. ' | Method | Spawn Rate |
---|---|---|---|---|
' .. frame:expandTemplate{title = "RescueTeamDX", args = {moveArg}} .. ' | ' .. frame:expandTemplate{title = "Research"} .. ' | ' .. frame:expandTemplate{title = "Research"} .. ' | ' .. frame:expandTemplate{title = "Research"} .. ' | ' .. (levelArg or frame:expandTemplate{title = "Research"}) .. ' |
')
return table.concat(output) end
return p