I’m using the following code inside my Facebook listener to show Facebook friends scores. The printTable(data) command shows the event.response table informations with no problem in the log screen, but I can’t manage to display them in the device screen.
Is there something wrong within my code?
[lua]
–…
elseif ( “request” == event.type ) then
local response = event.response
response = json.decode( event.response )
local data = response.data
printTable(data)
for i=1, #data, 1 do
friendsScoreTable[i].name = data[i].user.name;
friendsScoreTable[i].score = data[i].score;
friendsScoreText[i] = display.newText(friendsScoreTable[i].name … " " … friendsScoreTable[i].score, 0, 0, “ARIBLK”, 16);
if(i==1)then
friendsScoreText[i].x, friendsScoreText[i].y = centerX, centerY;
else
friendsScoreText[i].x, friendsScoreText[i].y = friendsScoreText[i-1].x, friendsScoreText[i-1].y+20;
end
localGroup:insert(friendsScoreText[i]);
end
end
[/lua]