ElEditors, Interface administrators, Administrators
70,872
edits
No edit summary |
No edit summary |
||
Line 85: | Line 85: | ||
-- Implement splitting string to a table. | -- Implement splitting string to a table. | ||
function split(s, delimiter) | function split(s, delimiter) | ||
if not s then return {} end | if not s then | ||
return {} | |||
end | |||
local i = 1 | local i = 1 | ||
if delimiter == nil then | if delimiter == nil then | ||
Line 164: | Line 166: | ||
end | end | ||
return num / decimals | return num / decimals | ||
end | |||
function formatnum(amount) | |||
local formatted = amount | |||
while true do | |||
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') | |||
if (k == 0) then | |||
break | |||
end | |||
end | |||
return formatted | |||
end | end |