Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Returns a string with decimal places every 3 digits
- local function decimals(input)
- local input = string.reverse(tostring(input))
- local t = {}
- local i = 1
- for str in string.gmatch(input, ".") do
- t[i] = str
- i = i + 1
- end
- local inc = 0
- local toReturn = ""
- for i=1, #t do
- if inc == 3 then
- inc = 1
- toReturn = toReturn..","..t[i]
- else
- inc = inc + 1
- toReturn = toReturn..t[i]
- end
- end
- return string.reverse(toReturn)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement