Module:User:KnightMiner/Sandbox

From Feed The Beast Wiki
Jump to: navigation, search

Documentation for this module may be created at Module:User:KnightMiner/Sandbox/doc

local p = {}

p.entries = function(f)
	local args = f.args or f
	
	if f == mw.getCurrentFrame() and args[1] == nil then
		args = f:getParent().args
	else
		f = mw.getCurrentFrame()
	end
	
	args = require([[Module:ProcessArgs]]).norm(args)
	local noAnim = args["no-anim"]
	local entry = args[1]

	-- if the entry does not exist, return a blank cell
	if not entry then
		return require([[Module:Grid]]).cell({})
	end
	args["no-anim"] = nil
	
	if args["no-oredict"] then
		args["no-oredict"] = "1"
	end
	
	if args.shuffle then
		args.shuffle = "1"
	end
	
	args.tag = "1"
	
	local output = { f:callParserFunction("#dict", args ) }

	-- wrap the output in span tags if we should be animated
	-- animation is disabled by either the parameter or a variable passed by [[Template:N]]
	if not noAnim and f:callParserFunction( "#var", "n-animated" ) == "" then
		table.insert( output, 1, '<span class="animated">' )
		table.insert( output, '</span>' )
	end
	
	return table.concat( output )
end

return p