Create a New Facebook ApplicationEdit

To connect your game to facebook you need to create a new facebook app by going to [11]. From there you can click the "Set Up New Application Button". After naming your new app, you'll be directed to the settings page. Here you will need to copy your new applications API Key. This is your unique identifier that the wild pockets plugin must know in order to make calls in your applications name.

From the settings page, the only other thing that you must do is under the Connect tab, change the Connect URL to '' (Note: Be sure to include the trailing slash). This will allow the plugin to make requests from that url.

Link your Pocket with your Facebook App Edit

Now that the facebook application is set up, you'll need to store you're API Key in the pocket that you'll be using. From the builder, go to your scenes Global Properties and under the Script tab you'll find a place to enter your facebook API Key that you acquired from your facebook application settings page. Now the facebook class has everything it needs to link it to your application.

Using the Facebook Class Edit

In order to use functions that request and post data the player must first authorize your application. Calling the function Facebook.requestLogin() will open an external page where the user can log into facebook. After they have logged in Facebook.isLoggedIn() will return true.

Now you can use some of the request/publish functions freely. One example is the Facebook.getFriendsInfo() function. This function accepts 2 arguments, a string of fields to get and a callback function. The string of fields is a comma separated list of fields such as ("name,birthday,sex"). A list of all the possible fields can be found in facebooks REST API documentation for users.getInfo.

Facebook Documentation for users.getInfo : [12]

The callback function will be called when the request is satisfied with two arguments, the result table and an error string. If the error string is nil, the call was a success and the table should contain a list of friend tables, each with keys matching your fields.

So an example call to request friends information would look like the following:

function receiveInfo(results, err)      if err ~= nil then              print ("Error : ", err)         else            for k,v in pairs(results) do                    print ( .. " - " ..                end     end end  Facebook.getFriendsInfo( "name,birthday,sex" , receiveInfo )