Content deleted Content added
No edit summary |
clean whitespace; local |
||
Line 2:
local function trimArg(arg)
end
Line 17:
-- Credit: http://lua-users.org/wiki/FormattingNumbers
local function comma_value(amount)
local k
if k == 0
break
end▼
end
function p.numberof(frame)
local tname = "NUMBEROF"
local result = -1
local data = mw.ext.data.get("Wikipedia_statistics/data.tab") -- https://commons.wikimedia.org/wiki/Data:Wikipedia_statistics/data.tab
local action = trimArg(args[1]) -- "ARTICLES, PAGES, EDITS, USERS, ACTIVEUSERS, ADMINS or FILES"
if not action then
Line 45:
local site2split = mw.text.split(site, "%.")
if tableLength(site2split) == 1 then
site = site .. ".wikipedia"
end
local comma = trimArg(args[3]) -- If set to "N" use commas in output
Line 51:
for k,v in pairs(data['data']) do
if site == mw.ustring.lower(v[1]) then
if action == "activeusers" then
result = v[2]
elseif action == "admins" then
result = v[3]
elseif action == "articles" then
result = v[4]
elseif action == "edits" then
result = v[5]
elseif action == "files" then
result = v[6]
elseif action == "pages" then
result = v[7]
elseif action == "users" then
result = v[8]
end
end
|