Module:BattleTeam: Difference between revisions

From Cassette Beasts
Solari (talk | contribs)
No edit summary
Solari (talk | contribs)
No edit summary
Line 1: Line 1:
local p = {}
local p = {}
local get_move_link = require('Module:Database').get_link


function p.get_moves(frame)
function p.get_moves(frame)
Line 11: Line 10:
:attr('align', 'center')
:attr('align', 'center')
:addClass('battle_move_link')
:addClass('battle_move_link')
:wikitext(get_move_link(move))
:wikitext(frame:callParserFunction('#invoke', 'Database', 'get_link', move))
:allDone()
:allDone()

Revision as of 00:12, 11 September 2026

Documentation for this module may be created at Module:BattleTeam/doc

local p = {}

function p.get_moves(frame)
	local move_list = mw.text.split(frame.args[1], ",", true)
	local result = {}
	
	for _, move in ipairs(move_list) do
		local row = mw.html.create('tr')
		local cell = row:tag('td')
			:attr('align', 'center')
			:addClass('battle_move_link')
			:wikitext(frame:callParserFunction('#invoke', 'Database', 'get_link', move))
			:allDone()
		
		table.insert(result, tostring(cell))
	end
	
	return table.concat(result)
end

return p