Can I confirm player posted?

I’m using the Social Plugin and would like to reward the player if they post to FB or Twitter.

What do I need to be looking for in the listener function?

I would like to reward them if they post or do something else if they didn’t post.

All I see in the sample code is this:

function listener:popup( event )

            print( “name(” … event.name … “) type(” … event.type … “) action(” … tostring(event.action) … “) limitReached(” … tostring(event.limitReached) … “)” )            

end

Is there a true or false value in there somewhere to check?

Thanks! 

You can dump the event table and see if there are other values there, if not, you have what’s there.

Rob

Problem is I don’t know how to print out to simulator because the social plugin doesn’t run on it. I really just need to know if player pressed post or cancel. It doesn’t seem like it should be difficult I just don’t see it noted what gets returned.

All devices have a console log that you can read just like the terminal.  See:

http://coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

Been searching for how to dump a table. I know I’ve seen it explained but of course I cannot find it now. And would the button pressed even be in there?

Man, this seems like it should be so easy. If player pressed post, do something. If player pressed cancel, do something else.

Sounds like event.action is your friend.

event.action = “sent” when a player has posted.

dumping the contents of a table:

for k, v in pairs(table) do print(k, v) end

I’m rather fond of the print_r() function found in the community code:

function print\_r ( t )     local print\_r\_cache={}     local function sub\_print\_r(t,indent)         if (print\_r\_cache[tostring(t)]) then             print(indent.."\*"..tostring(t))         else             print\_r\_cache[tostring(t)]=true             if (type(t)=="table") then                 for pos,val in pairs(t) do                     if (type(val)=="table") then                         print(indent.."["..pos.."] =\> "..tostring(t).." {")                         sub\_print\_r(val,indent..string.rep(" ",string.len(pos)+8))                         print(indent..string.rep(" ",string.len(pos)+6).."}")                     elseif (type(val)=="string") then                         print(indent.."["..pos..'] =\> "'..val..'"')                     else                         print(indent.."["..pos.."] =\> "..tostring(val))                     end                 end             else                 print(indent..tostring(t))             end         end     end     if (type(t)=="table") then         print(tostring(t).." {")         sub\_print\_r(t,"  ")         print("}")     else         sub\_print\_r(t,"  ")     end     print() end

It prints tables inside of tables.

Thanks for the help everyone!

It seems  3 variables are sent back.

event.type = “social”

event.name=“popup”

And the good one…

event.action = “sent” or “cancelled”

You can dump the event table and see if there are other values there, if not, you have what’s there.

Rob

Problem is I don’t know how to print out to simulator because the social plugin doesn’t run on it. I really just need to know if player pressed post or cancel. It doesn’t seem like it should be difficult I just don’t see it noted what gets returned.

All devices have a console log that you can read just like the terminal.  See:

http://coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

Been searching for how to dump a table. I know I’ve seen it explained but of course I cannot find it now. And would the button pressed even be in there?

Man, this seems like it should be so easy. If player pressed post, do something. If player pressed cancel, do something else.

Sounds like event.action is your friend.

event.action = “sent” when a player has posted.

dumping the contents of a table:

for k, v in pairs(table) do print(k, v) end

I’m rather fond of the print_r() function found in the community code:

function print\_r ( t )     local print\_r\_cache={}     local function sub\_print\_r(t,indent)         if (print\_r\_cache[tostring(t)]) then             print(indent.."\*"..tostring(t))         else             print\_r\_cache[tostring(t)]=true             if (type(t)=="table") then                 for pos,val in pairs(t) do                     if (type(val)=="table") then                         print(indent.."["..pos.."] =\> "..tostring(t).." {")                         sub\_print\_r(val,indent..string.rep(" ",string.len(pos)+8))                         print(indent..string.rep(" ",string.len(pos)+6).."}")                     elseif (type(val)=="string") then                         print(indent.."["..pos..'] =\> "'..val..'"')                     else                         print(indent.."["..pos.."] =\> "..tostring(val))                     end                 end             else                 print(indent..tostring(t))             end         end     end     if (type(t)=="table") then         print(tostring(t).." {")         sub\_print\_r(t,"  ")         print("}")     else         sub\_print\_r(t,"  ")     end     print() end

It prints tables inside of tables.

Thanks for the help everyone!

It seems  3 variables are sent back.

event.type = “social”

event.name=“popup”

And the good one…

event.action = “sent” or “cancelled”