Content deleted Content added
mNo edit summary |
Fixed off-by-one error |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1:
--- Example usage:
--- {{#invoke:Medical cases chart/data|externalData|page=COVID-19
--- =p._externalData({datapage="COVID-19
local p = {}
Line 21:
local change = current / previous * 100 - 100
local sign = change < 0 and "−" or "+"
return mw.ustring.format("%s%s%%", sign, lang:formatNum(round(math.abs(change))))▼
if (math.abs(change)) >= 10 then
return mw.ustring.format("%s%.0f%%", sign, (math.abs(change)))
end
if (math.abs(change)) < 1 then
return mw.ustring.format("%s%.3f%%", sign, (math.abs(change)))
end
end
Line 94 ⟶ 101:
for i = #records, 1, -1 do
local record = records[i]
if i < #records and record.streak > 3 then
for j = i, i - record.streak + 3, -1 do
table.remove(records, j)
|