Module:AddSeparator

From Idlescape Wiki
Revision as of 19:44, 29 October 2023 by Silent1 (talk | contribs) (Add comma thousand separators)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

local p = {}

function p.addSeparator(frame)
	local args = frame:getParent().args
	return p._addSeparator(args)
end

function p._addSeparator(args)
	local num = args[1]
	local price = 0
	
	return tostring(num):reverse():gsub("(%d%d%d)","%1,"):gsub(",(%-?)$","%1"):reverse()
end

return p