Modul:SK/Helper
< Modul:SK
Script error: The function "nonexistent" does not exist.
--------------------------------------------------------------------
-- Modul:SK/Helper
--------------------------------------------------------------------
local h = {}
-- Format broja s tisućicama
function h.num(n)
if not n then return "" end
local s = tostring(n)
local left, num, right = s:match('^([^%d]*%d)(%d*)(.-)$')
return left .. (num:reverse():gsub('(%d%d%d)','%1 '):reverse()) .. right
end
-- Format površine (km²)
function h.area(a)
if not a then return "" end
return string.format("%.2f km²", a)
end
-- Format gustoće (stan/km²)
function h.density(d)
if not d then return "" end
return string.format("%.1f st/km²", d)
end
-- Format stanovništva
function h.pop(p)
return h.num(p)
end
return h