Jump to content
Wikipedia The Free Encyclopedia

Module:NUMBEROF/data

From Wikipedia, the free encyclopedia
Module documentation[view] [edit] [history] [purge]
[画像:Warning] This Lua module is used in MediaWiki:Statistics-files-desc .
Changes to it can cause immediate changes to the Wikipedia user interface.
To avoid major disruption, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Please discuss changes on the talk page before implementing them.

Data retrieval from Commons. Invoked by Module:NUMBEROF one time per page.

The above documentation is transcluded from Module:NUMBEROF/data/doc. (edit | history)
Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.

 -- 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.

 localfunctionmakeData()
 localstatistics=mw.ext.data.get('Wikipedia statistics/data.tab')-- https://commons.wikimedia.org/wiki/Data:Wikipedia_statistics/data.tab
 localdata={}
 for_,vinipairs(statistics.data)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]}
 end
 localmap={}
 fori,vinipairs(statistics.schema.fields)do
 -- Assume "site" is first entry and skip it.
 ifi>1then
 map[v.name]=i-1-- name is lowercase
 end
 end
 return{
 data=data,
 map=map,
 }
 end

 returnmakeData()

AltStyle によって変換されたページ (->オリジナル) /