Difference between revisions of "Module:AddSeparator"

From Idlescape Wiki
Jump to navigation Jump to search
(Add comma thousand separators)
 
(No difference)

Latest revision as of 19:44, 29 October 2023

Documentation for this module may be created at Module:AddSeparator/doc

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