When post to facebook with a number in my string generated via a lua conversion from an integer with commas or other punctuation in it, the post fails without an error message.
Simple example Code:
local gameScore = comma\_value(theScore)
local theMessage = "I just scored " .. gameScore .. " points testing my game."
facebook.request( "me/feed", "POST", {message = theMessage})
if I change the above code to:
local theMessage = "I just scored 12,437 points testing my game."
facebook.request( "me/feed", "POST", {message = theMessage})
it works.
Also if I change it to:
local gameScore = tostring(theScore)
local theMessage = "I just scored " .. gameScore .. " points testing my game."
facebook.request( "me/feed", "POST", {message = theMessage})
it works.
Here is the comma code:
comma\_value = function(amount)
local formatted = tostring(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
but it doesn’t matter. I have tried three other different comma functions including one I wrote myself specifically not to use pattern matching.
It’s not just the “message” field, it also fails in the “caption” field in an attachment. (I imagine other fields as well although I have not tested.
I am using build #777 for universal ios. Since I am developing a game with scores that can get very high it looks very unprofessional in posts from the game not to have comma separated numbers.
[import]uid: 98849 topic_id: 24550 reply_id: 324550[/import]