Module:Item Tags

From The Binding of Isaac: Rebirth Wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:Item Tags/doc

local p = {}

local w_frame = require( 'module:frame' )
local tagData = mw.loadData( 'module:Item_Tags/data' ).tagData

function _get( name, dataType, def )
	local d = tagData[name]
	if d then
		return d[dataType] or def
	end
	return def
end

function _friendly( name )
	return _get(name, 'friendly', name)
end
function _url( name )
	return _get(name, 'url', 'Item_Tags_' ..name)
end

function p.friendly( f )
	local args = w_frame.args( f )
	return _friendly(args[1])
end
function p.url( f )
	local args = w_frame.args( f )
	return _url(args[1])
end
function p.friendly_url( f )
	local args = w_frame.args( f )
	return '[[' .._url(args[1]) .. '|' .. _friendly(args[1]) .. ']]'
end

return p