Module:Rescue Team DX Pokémon Locations table

MDFW - The Mystery Dungeon Tree of Information.
Revision as of 19:18, 23 October 2023 by Golisopod (talk | contribs)
Jump to navigation Jump to search

Documentation for this module may be created at Module:Rescue Team DX Pokémon Locations table/doc

--------------------------------------------------------------------------------
--
--				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, '<th class="templatePrimary" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Level"}} .. '</th>')
	table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">Floors</th>')
	table.insert(output, '</tr>')
	-- Data rows
	for i = 1, 150 do
		local levelArg = args["level_" .. i]
		if not monsterArg and not floorsArg and not levelArg then
			break -- exit loop when no more rows are found
		end
		table.insert(rowData, '<td class="templateSecondary">' .. (levelArg or "") .. '</td>')
		table.insert(rowData, '<td class="templateSecondary">' .. (floorsArg or "") .. '</td>')
		table.insert(rowData, '</tr>')
		table.insert(output, table.concat(rowData))
	end
	table.insert(output, '</table>')
	return table.concat(output)
end

return p