Minecraft Wiki
KKeine Bearbeitungszusammenfassung
KKeine Bearbeitungszusammenfassung
Zeile 14: Zeile 14:
 
local invImage, invNum = k:match( '^(invimage)(%d+)$' )
 
local invImage, invNum = k:match( '^(invimage)(%d+)$' )
 
if v:lower() ~= 'none' and invImage then
 
if v:lower() ~= 'none' and invImage then
local image = args[k]
+
local image = args['invimage' .. invNum]
 
if image == 'title' then
 
if image == 'title' then
 
image = (invIds[title] or invAliases[title]) and title or false
 
image = (invIds[title] or invAliases[title]) and title or false

Version vom 5. Juli 2021, 21:04 Uhr

[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 ii1_org = args.invimage1
	args.invimage1 = args.invimage1 or args.invimage or 'title'
	
	for k, v in pairs( args ) do
		if type( k ) == 'string' then
			local invImage, invNum = k:match( '^(invimage)(%d+)$' )
			if v:lower() ~= 'none' and invImage then
				local image = args['invimage' .. invNum]
				if image == 'title' then
					image = (invIds[title] or invAliases[title]) and title or false
				end
				
				if image == '----' then
					table.insert( invImages, tonumber(invNum or 1), '</div><div style="padding-top:.5em">' )
				elseif image then
					table.insert( invImages, tonumber(invNum or 1), slot{ image, link = 'none' } )
				end
			end
		end
	end

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