Module:Map/Icon list

From the RuneScape Wiki, the wiki for all things RuneScape
Jump to navigation Jump to search
Module documentation
This documentation is transcluded from Module:Map/Icon list/doc. [edit] [history] [purge]
Module:Map/Icon list's function main is invoked by Template:Map/Icons.
Module:Map/Icon list loads data from Module:Map/icons.
Function list
L 6 — p.main

Used to generate a table list of all the icons from Module:Map/icons.


-- <nowiki>
local icons = mw.loadData('Module:Map/icons')

local p = {}

function p.main()
	local ret = mw.html.create('table')
	ret	:addClass('wikitable sortable')
		:tag('tr')
			:tag('th'):wikitext('Icon'):done()
			:tag('th'):wikitext('Name / Alias'):done()
			:tag('th'):wikitext('Size<br>Anchor'):done()
		:done()
	
	for i,v in pairs(icons) do
		ret	:tag('tr')
				:tag('td'):wikitext( string.format('[[File:%s|%sx%spx|link=]]', v.icon, math.ceil(v.iconSize[1]), math.ceil( v.iconSize[2])) ):done()
				:tag('td'):wikitext( '<i>'..i..'</i>' )
				:tag('td'):wikitext( string.format('%s X %s<br>%s X %s', v.iconSize[1], v.iconSize[2], v.iconAnchor[1], v.iconAnchor[2]) )
			:done()
	end
	
	return ret
end

return p