Module:Adventure Squad Moves table

MDFW - The Mystery Dungeon Tree of Information.
Revision as of 21:17, 27 November 2024 by B (talk | contribs)
Jump to navigation Jump to search

Documentation for this module may be created at Module:Adventure Squad Moves table/doc

--------------------------------------------------------------------------------
--
--				Module:Adventure Squad Move Learned by Level-up table
--
--------------------------------------------------------------------------------

local p = {}
local mw = require('mw')

function p.main(frame)
	local args = frame.args

	local output = mw.html.create()

	local data = require("Module:Adventure Squad Move Data Cell")
	local metatable = {__index = function () return "" end}
	setmetatable(data, metatable)

	local i = 1 -- sets the initial value to 1
	while true do -- starts the loop
		local dungeonArg = args["move_" .. i] -- sets the current dungeonArg to the data for dungeon_1, or dungeon_2, or dungeon_3, depending on where the loop is at
		
		if not dungeonArg then break end -- exits the loop when there is no more data to find
		-- (example: the page only has dungeon_1 and dungeon_2, so the loop ends there)
		
		output:tag('dt'):wikitext(dungeonArg):done() -- prints the dungeonArg
		output:tag('dd'):wikitext(data[dungeonArg]["ja"]):done()
		output:tag('dd'):wikitext(data[dungeonArg]["type"]):done()
		output:tag('dd'):wikitext(data[dungeonArg]["pp"]):done()
		output:tag('dd'):wikitext(data[dungeonArg]["range"]):done()

		i = i + 1 -- increases the value by 1 to go to the next entry from the page's source (example: dungeon_1, increaases to dungeon_2, then dungeon_3, etc.)

		end

	return tostring(output) -- prints the data
	end

return p