Gaan na inhoud


in Wikipedia, die vrye ensiklopedie

This module loads tabular (JSON) data from Commons into a Lua associative array. This module is loaded *by* mw.loadData() thus is invoked once only per page.

-- Return a table of statistics to be accessed once per page using mw.loadData.
-- The table contains counts of edits, pages and more for each project.

local function makeData()
	local statistics ='Wikipedia statistics/') --
	local data = {}
	for _, v in ipairs( do
		-- Assume "site" is first entry of 8.
		data[v[1]] = { v[2], v[3], v[4], v[5], v[6], v[7], v[8] }
	local map = {}
	for i, v in ipairs(statistics.schema.fields) do
		-- Assume "site" is first entry and skip it.
		if i > 1 then
			map[] = i - 1  -- name is lowercase
	return {
		data = data,
		map = map,

return makeData()