The Gamepedia and Fandom account systems have now been merged. If your username is incorrect, you have accounts on both platforms that weren't merged, or you have trouble signing in, please submit a support ticket.

Module:KnightMiner/DeprecatedSprites

From Minecraft Wiki
Jump to: navigation, search
[view | edit | history | purge]DocumentationJump to code ↴

This module pulls a list of deprecated sprites from one of the sprite ID modules and displays it in a simply formatted fashion.

Usage[edit]

To run p.deprecated, simply set the first parameter to the name of a sprite sheet; for example, Block

Example[edit]

{{#invoke:KnightMiner/DeprecatedSprites|deprecated|Block}}

[view | edit | history | purge]The above documentation is transcluded from Module:KnightMiner/DeprecatedSprites/doc.
local p = {}
function p.deprecated( f )
	local name = f.args[1] .. 'Sprite'
	
	-- Load the list of sprites based on the name given
	local data = mw.loadData( 'Module:' .. name ).ids
	
	-- Go over every sprite to check for deprecated sprites
	local output = {}
	for k, v in pairs( data ) do
		if v.deprecated then
			table.insert( output, '<code>' .. k .. '</code>' )
		end
	end

	-- If we have results, then format them a bit and return results
	if #output > 0 then
		table.sort( output )

		-- Add a dummy item to make the list easier
		table.insert( output, 1, '' )

		local div = mw.html.create( 'div' ):css{
			        ['column-width'] = '15em',
			   ['-moz-column-width'] = '15em',
			['-webkit-column-width'] = '15em'
		}:wikitext( table.concat( output, '\n* ' ) )
		
		return '; [[Template:' .. name .. '|' .. name .. ']] \n' .. tostring( div )
	end
end

return p