IDT Mod Wiki
Advertisement

Documentation for this module may be created at Module:Inventory icon/doc

local sprite = require( [[Module:Sprite]] ).sprite
local ids = mw.loadData( [[Module:InvSprite/IDs]] ).ids
local p = {}

p.icon = function( f )
	local args = f
	if f == mw.getCurrentFrame() then
		args = f:getParent().args
	end
	
	local idData = ids[args[1]]
	local icon, category
	local link = args.link
	local title = args.title
	
	if idData then
		icon, category = sprite{
			iddata = idData, link = link, title = title,
			settings = 'InvSprite'
		}
	else
		icon = '[[File:Grid ' .. args[1] .. '.png|32x32px|link=' .. ( link or '' ) .. '|' .. ( title or '' ) .. ']]'
	end
	
	return icon .. ( category or '' )
end

return p
Advertisement