Minecraft Wiki
Majr (diskuse | příspěvky)
(Undo revision 879135 by KnightMiner (talk) fixed)
 
Majr (diskuse | příspěvky)
m (naimportována 1 revize: Import EN modules)
 

Aktuální verze z 17. 7. 2017, 10:52

[create | history | purge]Documentation
This module has no documentation. If you know how to use this module, please create it.
local p = {}
p.row = function( f )
	local args = f
	if f == mw.getCurrentFrame() then
		args = f:getParent().args
	else
		f = mw.getCurrentFrame()
	end
	local resource = mw.text.trim( args[1] or '' )
	local product = mw.text.trim( args[2] or '' )
	local slot = require( 'Module:Inventory slot' )
	local output = {}

	local title
	if args.title or '' ~= '' then
		title = args.title
    else
		local titles = {}
		for v in mw.text.gsplit( resource, '%s*,%s*' ) do
			local resources = slot.getParts( v ).name:gsub( '^Any ', '' )
			table.insert( titles, '[[' .. resources .. ']]' )
		end
		title = mw.text.listToText( titles )
	end

	local icon = function( var )
		local out = {}
		for icons in mw.text.gsplit( var, '%s*,%s*' ) do
			table.insert( out, slot.slot{ icons, class = 'invslot-plain' } )
		end
		return table.concat( out )
	end

	local resourceicon
	if resource ~= '' then
		resourceicon = '<br>' .. icon( resource )
	else
		resourceicon = ''
	end

	table.insert( output, '| style="text-align:center" | ' .. title .. resourceicon )

	local align = 'center'
	if f:callParserFunction( '#var', 'renewable-method' ) ~= '' then
		align = 'left'
	end

	local products
	if args.product or '' ~= '' then
		products = args.product
	elseif product ~= '' then
		products = icon( product )
	else
		products = '—'
	end

	table.insert( output, '| style="text-align:' .. align .. '" | ' .. products )

	if f:callParserFunction( '#var', 'renewable-method' ) == '' then
		table.insert( output, '| ' .. ( args[3] or '' ) )
	end

	table.insert( output, '|-' )

	return table.concat( output, '\n' )
end
return p