Module:C

local p = {}

function p.convert(frame) return '~' .. comma_value(string.format("$%.2f", frame.args[1])) end

function comma_value(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

return p