Modul:SK/Statistika
< Modul:SK
Script error: The function "nonexistent" does not exist.
--------------------------------------------------------------------
-- Modul:SK/Statistika
--------------------------------------------------------------------
local p = {}
local sort = require("Modul:SK/Sort")
local h = require("Modul:SK/Helper")
function p.top(frame)
local mode = (frame.args[1] or frame:getParent().args[1] or "gustoća")
local field, desc, fmt
if mode == "gustoća" then
field, desc, fmt = "density", true, h.density
elseif mode == "stanovništvo" then
field, desc, fmt = "pop", true, h.pop
elseif mode == "površina" then
field, desc, fmt = "area", true, h.area
else
field, desc, fmt = "density", true, h.density
end
local t = sort.top(field, 10, desc)
local out = {}
for i, r in ipairs(t) do
out[#out+1] = string.format(
"|-\n| %d || [[%s]] || %s",
i,
r.naziv,
fmt(r[field])
)
end
return table.concat(out, "\n")
end
return p