score display help

Is possible to display score with dots or spaces like this 100.000.000

This stack overflow post might be of use to you:

http://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript

Rob

thanks

hi again

i found this but i have problem

local function addThousandsSeparators(num)         --Number of loops         num = tostring(num)         loops = string.sub(((string.len(num)/3)), 1,1)           --Find out the leading characters         leadingChars = math.fmod (string.len(num), 3)         --Offset loop when there's no leading characters         if (leadingChars == 0) then                         loops = loops - 1                         reach = 3         elseif (leadingChars == 1) then                         reach = 1         elseif (leadingChars == 2) then                         reach = 2         end           --Reverse because it's easier to count backwards         numtemp = string.reverse(num)         numnew = ""           --Add commas at interval         for i=1, loops, 1 do                         numnew = numnew .. (string.sub (numtemp, ((i\*3)-2), i\*3) .. "," )         end           --Recombine         numnew = string.sub(num, 1, reach) .. string.reverse(numnew)           --Send new value         return numnew end    txt\_clicks = display.newText(addThousandsSeparators"Clicks left:" .. numberOfclicks,0,0,native.systemFont, 16)  

it display it like this http://imgur.com/Sbeiz8H

how do i make it to effect to numberOfclicks

Try this:

txt_clicks = display.newText(“Clicks left:” … addThousandsSeparators( numberOfclicks ),0,0,native.systemFont, 16)

You only want it to process the number, but you were having it also work on the string.  And since it’s a function you have to have parenthesis around the value to operate on.

Rob

thank you

This stack overflow post might be of use to you:

http://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript

Rob

thanks

hi again

i found this but i have problem

local function addThousandsSeparators(num)         --Number of loops         num = tostring(num)         loops = string.sub(((string.len(num)/3)), 1,1)           --Find out the leading characters         leadingChars = math.fmod (string.len(num), 3)         --Offset loop when there's no leading characters         if (leadingChars == 0) then                         loops = loops - 1                         reach = 3         elseif (leadingChars == 1) then                         reach = 1         elseif (leadingChars == 2) then                         reach = 2         end           --Reverse because it's easier to count backwards         numtemp = string.reverse(num)         numnew = ""           --Add commas at interval         for i=1, loops, 1 do                         numnew = numnew .. (string.sub (numtemp, ((i\*3)-2), i\*3) .. "," )         end           --Recombine         numnew = string.sub(num, 1, reach) .. string.reverse(numnew)           --Send new value         return numnew end    txt\_clicks = display.newText(addThousandsSeparators"Clicks left:" .. numberOfclicks,0,0,native.systemFont, 16)  

it display it like this http://imgur.com/Sbeiz8H

how do i make it to effect to numberOfclicks

Try this:

txt_clicks = display.newText(“Clicks left:” … addThousandsSeparators( numberOfclicks ),0,0,native.systemFont, 16)

You only want it to process the number, but you were having it also work on the string.  And since it’s a function you have to have parenthesis around the value to operate on.

Rob

thank you