Module:Crafting usage

local p = {} function p.dpl( f ) local args = require( 'Module:ProcessArgs' ).merge local title = mw.title.getCurrentTitle.text local craftingArgs = { args[1] or args.A1, args[2] or args.B1, args[3] or args.C1, args[4] or args.A2, args[5] or args.B2, args[6] or args.C2, args[7] or args.A3, args[8] or args.B3, args[9] or args.C3, Output = args.Output }	local usedRecipes = f:callParserFunction( '#dplvar:craftingrecipes' ) local hasIngredient for _, v in ipairs( craftingArgs ) do		if v:find( title ) then if usedRecipes:find( args.Output ) then return end if not v:find( ';' ) then hasIngredient = 'static' elseif not hasIngredient then hasIngredient = 'animated' end end end if not hasIngredient then return end local maxFrames = 1 local requiredFrames = {} if hasIngredient == 'animated' then for _, v in ipairs( craftingArgs ) do			if v:find( ';' ) then local frameNum = 0 for frame in mw.text.gsplit( v, '%s*;%s*' ) do					frameNum = frameNum + 1 if frameNum > maxFrames then maxFrames = frameNum end if not requiredFrames[frameNum] and frame:find( title ) then requiredFrames[frameNum] = true end end end end end if maxFrames > 1 then local frames = {} for k, arg in pairs( craftingArgs ) do			if arg:find( ';' ) then local frameNum = 0 for frame in mw.text.gsplit( arg, '%s*;%s*' ) do					frameNum = frameNum + 1 if requiredFrames[frameNum] then if not frames[k] then frames[k] = {} end table.insert( frames[k], frame ) end end frames[k] = table.concat( frames[k], ';' ) else frames[k] = arg end end f:callParserFunction( '#dplvar:set', 'craftingrecipes', usedRecipes .. ';' .. frames.Output ) if args[1] then for k, arg in pairs( frames ) do				args[k] = arg end else args.A1 = frames[1]; args.B1 = frames[2]; args.C1 = frames[3] args.A2 = frames[4]; args.B2 = frames[5]; args.C2 = frames[6] args.A3 = frames[7]; args.B3 = frames[8]; args.C3 = frames[9] args.Output = frames.Output end -- If not all frames are used, overwrite custom name and ingredient values if maxFrames > #requiredFrames then args.name = nil args.ingredients = nil end else f:callParserFunction( '#dplvar:set', 'craftingrecipes', usedRecipes .. ';' .. args.Output ) end local crafting = require( 'Module:Crafting' ).table args.head = '1' args.foot = nil args.nocat = '1' args.showdescription = f:callParserFunction( '#dplvar:craftingdescription' ) return crafting( args ) end return p