Module:BattleTeam: Difference between revisions

From Cassette Beasts
Solari (talk | contribs)
No edit summary
Solari (talk | contribs)
No edit summary
Line 7: Line 7:
for _, move in ipairs(move_list) do
for _, move in ipairs(move_list) do
local row = mw.html.create('tr')
local row = mw.html.create('tr')
:attr('align', 'center')
:attr('align', 'left')
local cell = row:tag('td')
local cell = row:tag('td')
:addClass(frame:callParserFunction('#invoke', 'Database', 'get_move', move, 'elemental_type') .. "_type")
:addClass(frame:callParserFunction('#invoke', 'Database', 'get_move', move, 'elemental_type') .. "_type")
:cssText('display: inline-block; line-height: 1.1em; background-repeat: no-repeat; background-position: calc(0% - 0.21em) center; background-size: 1.65em; padding-left: 1.75em; background-color: transparent;')
:cssText('display: inline-block; line-height: 1.1em; background-repeat: no-repeat; background-position: calc(0% - 0.21em) center; background-size: 1.66em; padding-left: 1.75em; background-color: transparent;')
:wikitext(frame:callParserFunction('#invoke', 'Database', 'get_link', 'move', move))
:wikitext(frame:callParserFunction('#invoke', 'Database', 'get_link', 'move', move))
:allDone()
:allDone()

Revision as of 12:41, 13 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')
			:attr('align', 'left')
		local cell = row:tag('td')
			:addClass(frame:callParserFunction('#invoke', 'Database', 'get_move', move, 'elemental_type') .. "_type")
			:cssText('display: inline-block; line-height: 1.1em; background-repeat: no-repeat; background-position: calc(0% - 0.21em) center; background-size: 1.66em; padding-left: 1.75em; background-color: transparent;')
			:wikitext(frame:callParserFunction('#invoke', 'Database', 'get_link', 'move', move))
			:allDone()
		
		table.insert(result, tostring(cell))
	end
	
	return table.concat(result)
end

return p