Module:Sandbox

local slot = require( Module:Inventory slot ).slot local addSlot = function( args, item, prefix, class, default ) local none local nostacksize if prefix == '' or nil then none = 'none' nostacksize = ((item ==  or nil) and ) or (args[item] and args[item]:gsub( '[,%d]',  ) or ) end return slot{ nostacksize or args[item], mod = args.Mod, link = none or args[prefix .. 'link'], title = none or args[prefix .. 'title'], class = class, default = default, parsed = args.parsed } end local bannerSprite = function ( icon ) local ids = require( Module:SlotSprite ).ids local sprite = require( Module:Sprite ).sprite local idData = ids[icon] or 'none' local image

if idData ~= 'none' then image = sprite{ iddata = idData, data = 'SlotSprite' }	else image = ' ' end

return image end

local p = {}

-- Loom function p.loom( f ) local args = f	if f == mw.getCurrentFrame then args = f:getParent.args else f = mw.getCurrentFrame end local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Loom pixel-image' ) local tapestry = body:tag( 'span' ):addClass( 'mcui-tapestry' ) if args[Banner] ~= '' or nil then tapestry :wikitext( addSlot( args, 'Banner', 'B', 'mcui-inputBanner' ) ) else tapestry:tag( 'span' ):tag( 'br' ):done end if args[Dye] ~= '' or nil then tapestry :wikitext( addSlot( args, 'Dye', 'D', 'mcui-inputDye' ) ) tapestry:tag( 'span' ):tag( 'br' ):done end if args[Pattern] ~= '' or nil then tapestry :wikitext( addSlot( args, 'Pattern', 'P', 'mcui-inputPattern' ) ) else tapestry:tag( 'span' ):tag( 'br' ):done end local arrow = body:tag( 'span' ):addClass( 'mcui-loomArrow' ) if args.arrow or  ~=  then arrow:css(			'background-image',			''		) end arrow :tag( 'span' ) :addClass( 'mcui-bannerSprite' ) :wikitext( bannerSprite( args[Pattern] ) ) body :tag( 'span' ) :addClass( 'mcui-output' ) :wikitext( addSlot( args, 'Output', 'O', 'invslot-large' ) ) return tostring( mw.html.create( 'div' ):node( body ) ) end

return p