PC Gaming Shelter
An archive dedicated to preserving PC Gaming history and more

Module:Series

From PC Gaming Shelter

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

local utils = require( "Module:Utils" )

local p = {}

function p.main()
	local series = utils.availablePropertyValues('Has series')
	local html = mw.html.create()
	local seriesTable = {}
	for _, game in ipairs(series) do
		local usage = mw.smw.ask{
			'[[Has series::' .. game .. ']]',
			'limit=1000',
		} or {}
		local seriesLink = string.format('[[%s]] (%s)', game, #usage)
		table.insert(seriesTable, seriesLink)
		table.sort(seriesTable)
	end
	local ul = html:tag('ul')
	for _, link in ipairs(seriesTable) do
		ul:tag('li'):wikitext(link)
	end
	
	return html
end

return p