Minecraft Wiki
Advertisement
[створити | історія | оновити]Документація
У цього модуля немає документації. Якщо ви знаєте, як використовувати цей модуль, будь ласка, додайте відповідну інформацію.
local p = {}
p.table = function()
	local slot = require( [[Модуль:Інвентарний слот]] )
	local aliases = mw.loadData( [[Модуль:Інвентарний слот/Псевдоніми]] )
	
	local aliasNames = {}
	local aI = 1
	for name in pairs( aliases ) do
		-- Skip the banner aliases (except "Any Banner"), as there are so
		-- many of them it causes the table to be excessively long
		if name == 'Будь-який стяг' or not name:find( ' стяг$' ) and not name:find( '^Відповідний ' ) then
			aliasNames[aI] = name
			aI = aI + 1
		end
	end
	table.sort( aliasNames )
	
	local tableRows = {
		' {| class="wikitable collapsible collapsed"',
		'! Alias !! Output'
	}
	local rI = #tableRows + 1
	for _, name in ipairs( aliasNames ) do
		local alias = slot.getAlias( aliases[name], {} )
		
		local cell = {}
		for i, frame in ipairs( alias ) do
			cell[i] = slot.slot{ { frame }, parsed = true }
		end
		
		local aliasText = mw.html.create()
		aliasText:tag( 'code' ):wikitext( name )
		if name:find( '^Будь\-як(ий|а|е|і) ' ) then
			aliasText:tag( 'br' ):done()
				:tag( 'code' ):wikitext( ( name:gsub( '^Будь\-як(ий|а|е|і)', 'Відповідн(ий|а|е|і)' ) ) )
		end
		
		tableRows[rI] = '|' .. tostring( aliasText ) .. '||' .. table.concat( cell )
		rI = rI + 1
	end
	tableRows[rI] = '|}'
	
	return table.concat( tableRows, '\n|-\n' )
end
return p
Advertisement