Module:NUMBEROF: Difference between revisions

Content deleted Content added
implement DEPTH parameter for Wikipedias that use it
fix depth: need map
Line 16:
-- https://meta.wikimedia.org/wiki/Wikipedia_article_depth
-- This gives silly results if, for example, the number of articles is small.
iflocal stats.pagesn == 0{ or stats.'articles', =='edits', 0'pages' then}
if map then
for i, v in ipairs(n) do
n[i] = map[v]
end
end
for i, v in ipairs(n) do
n[i] = stats[v] or 0
end
local articles, edits, pages = n[1], n[2], n[3]
if pages == 0 or articles == 0 then
return 0
end
return math.floor((stats.edits/stats.pages) * ((stats.pages - stats.articles)/stats.articles)^2)
end
if map then