Module:NUMBEROF: Difference between revisions

Content deleted Content added
style tweaks
more consistent with usage on other Wikipedias, e.g. af:Module:NUMBEROF; don't need en2 and can re-add it if ever wanted
Line 42:
-- return numberof result for given action, or nil.
-- This is faster than reading the cached table, and gives the current value.
local localSite = string.match(mw.site.server, '.*//(.*)%.org$') -- examples: 'enaf.wikipedia', 'commons.wikimedia'
if site == localSite then
if action == 'activeusers' then
Line 57:
action = trimArg(action:sub(9), 1)
end
local site = trimArg(args[2], 2) -- "enaf" or "enaf.wikipedia" or "enaf.wikiquote" etc., including "total"
if not site:find('.', 1, true) then
site = site .. '.wikipedia'
end
local wantComma = trimArg(args[3]) -- nil for no commas in output; "N" or anything nonblank inserts commas
local result = getIfLocal(site, action)
if site == 'en2.wikipedia' then
site = 'en.wikipedia' -- get cached data rather than live values
else
result = getIfLocal(site, action)
end
if not result then
local data = mw.loadData('Module:NUMBEROF/data')