Minecraft Wiki
Advertisement
[Erstellen | Versionen | Aktualisieren]Buch und Feder DokumentationLua logo Zum Gebrauch von Lua-Modulen siehe die Modul-Hilfe.
Dieses Modul hat keine Dokumentation. Wenn du weißt, wie es funktioniert, dann erstelle sie bitte.
local p = {}
function p.main( f )
	local args = f:getParent().args
	local title = args.title or titleObject.baseText
	local invImages = {}
	local invIds = mw.loadData( 'Modul:InvSprite' ).ids
	local invAliases = mw.loadData( 'Modul:Inventar slot/Aliases' )
	local slot = require( 'Modul:Inventar slot' ).slot
	local first_image = args.invimage1 or args.invimage or 'title'
	
	local function addImage(imgName, imgNum)
		local image = args['invimage' .. imgNum]
		if imgName == 'title' then
			image = (invIds[title] or invAliases[title]) and title or false
		end
		
		table.insert( invImages, tonumber(imgNum or 1), imgName == '----' and '</div><div style="padding-top:.5em">' or slot{ image, link = 'none' } )
	end
	
	if first_image == 'title' then
		addImage('title', 1)
	end
	
	for k, v in pairs( args ) do
		if type( k ) == 'string' then
			local invImage, invNum = k:match( '^(invimage)(%d+)$' )
			invImage = invImage or k == 'invimage' and 'invimage' or nil
			if v:lower() ~= 'none' and invImage then
				addImage(invImage, invNum or 1)
			end
		end
	end

	return #invImages > 0 and '<div>' .. table.concat( invImages, '' ) .. '</div>' or ''
end
return p
Advertisement