Module:Adventure Squad Moves table: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary Tag: Reverted |
||
Line 9: | Line 9: | ||
function p.main(frame) | function p.main(frame) | ||
local args = frame.args | local args = frame.args | ||
local output = mw.html.create() | local output = mw.html.create() | ||
local data = require("Module:Adventure Squad Move Data Cell") | |||
local | local metatable = {__index = function () return "" end} | ||
local | setmetatable(data, metatable) | ||
if not | local i = 1 -- sets the initial value to 1 | ||
while true do -- starts the loop | |||
local dungeonArg = args["dungeon_" .. 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]["version"]):done() -- takes the "version" data from the Data Cell of the current dungeonArg and prints it | |||
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 | end | ||
return tostring(output) -- prints the data | |||
end | end | ||
return p | return p |
Revision as of 21:08, 27 November 2024
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["dungeon_" .. 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]["version"]):done() -- takes the "version" data from the Data Cell of the current dungeonArg and prints it
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