Module:BattleTeam: Difference between revisions

From Cassette Beasts
Solari (talk | contribs)
No edit summary
Solari (talk | contribs)
No edit summary
Line 4: Line 4:
function p.get_moves(frame)
function p.get_moves(frame)
local move_list = mw.text.split(frame.args[1], ",")
local move_list = mw.text.split(frame.args[1], ",")
local result = ""
local result = {}
for _, move in ipairs(move_list) do
for _, move in ipairs(move_list) do
Line 13: Line 13:
:wikitext(get_move_link(move))
:wikitext(get_move_link(move))
:allDone()
:allDone()
result = result .. tostring(cell)
table.insert(result, tostring(cell))
end
end
return result
return table.concat(result)
end
end


return p
return p

Revision as of 00:04, 11 September 2026

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

local p = {}
local get_move_link = require('Module:Database').get_link

function p.get_moves(frame)
	local move_list = mw.text.split(frame.args[1], ",")
	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(get_move_link(move))
			:allDone()
		
		table.insert(result, tostring(cell))
	end
	
	return table.concat(result)
end

return p