Module:Explorers of Sky Moves table
Jump to navigation
Jump to search
Documentation for this module may be created at Module:Explorers of Sky Moves table/doc
--------------------------------------------------------------------------------
--
-- Module:Explorers of Sky Moves 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; width: 50%; margin: auto;">')
table.insert(output, '<tr>')
table.insert(output, '<th colspan="2" class="templatePrimary">' .. frame:expandTemplate{title = "ExplorersOfSky", args = {"Move"}} .. '</th>')
table.insert(output, '<th rowspan="2" class="templatePrimary" style="width: 10%;">' .. frame:expandTemplate{title = "ExplorersOfSky", args = {"Type"}} .. '</th>')
table.insert(output, '<th rowspan="2" class="templatePrimary" style="width: 10%;">' .. frame:expandTemplate{title = "ExplorersOfSky", args = {"Level"}} .. '</th>')
table.insert(output, '<th rowspan="2" class="templatePrimary" style="width: 10%;">Base ' .. frame:expandTemplate{title = "ExplorersOfSky", args = {"PP"}} .. '</th>')
table.insert(output, '<th rowspan="2" class="templatePrimary" style="width: 20%;">Range</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 moveArg = args["move_" .. i]
local levelArg = args["level_" .. i]
if not moveArg and not levelArg then
break -- exit loop when no more rows are found
end
local moveType = frame:preprocess('{{#invoke:Explorers of Sky Move Data Cell|explorersOfSkyMoveDataCell|name=' .. (moveArg or "") .. '|getVar=type}}')
local rowData = {}
table.insert(rowData, '<tr class="itemsTableRow">')
if moveArg then
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "ExplorersOfSky", args = {moveArg}} .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Explorers of Sky Move Data Cell|explorersOfSkyMoveDataCell|name=' .. moveArg .. '|getVar=ja}}') .. '</td>')
table.insert(rowData, '<td class="templatePrimary">' .. frame:expandTemplate{title = "TypePKMN", args = {moveType}} .. '</td>')
else
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Research"} .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Research"} .. '</td>')
table.insert(rowData, '<td class="templatePrimary">' .. frame:expandTemplate{title = "Research"} .. '</td>')
end
table.insert(rowData, '<td class="templateSecondary">' .. (levelArg or frame:expandTemplate{title = "Research"}) .. '</td>')
if moveArg then
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Explorers of Sky Move Data Cell|explorersOfSkyMoveDataCell|name=' .. moveArg .. '|getVar=pp}}') .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Explorers of Sky Move Data Cell|explorersOfSkyMoveDataCell|name=' .. moveArg .. '|getVar=range}}') .. '</td>')
else
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Research"} .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Research"} .. '</td>')
end
table.insert(rowData, '</tr>')
table.insert(output, table.concat(rowData))
end
table.insert(output, '</table>')
return table.concat(output)
end
return p