Type Function Library facebook.* Return value Event Revision 2017.3060 Keywords See also facebook.login() fbconnect Implementing Facebook
Displays a Facebook UI dialog for publishing posts to a user's stream. This API pops up a Facebook UI that the user interacts with. Use facebook.request() if you need the application to do the posting.
The response from the dialog comes back as a fbconnect event that is sent to the listener function which was registered with the call to facebook.login().
Please see the Implementing Facebook guide for important iOS and
facebook.showDialog( action [, params ] )
Displays a native view controller, allowing the user to choose a place where they are.
facebook.showDialog( action, options, onComplete )
String. The dialog you want to show. For the place picker, you should pass "place".
Table. This is a Lua table of key/value pairs that are passed as arguments to the Facebook API call. Supported keys are:
title — string value for the title that will appear in the view controller's navigation bar (top of the screen).searchText — string value for the type of place you wish to search for. i.e. "restaurant", "hospital", "supermarket", etc.longitude — numerical value for the longitude value of the place.latitude — numerical value for the latitude value of the place.resultsLimit — number representing the maximum number of results shown in the view controller.radiusInMeters — numerical value for the radius in meters that the search should span.Listener. This listener is executed upon selecting a place.
Displays a native view controller, allowing the user to choose who they are with.
facebook.showDialog( action, onComplete )
String. The dialog you want to show. For the friend picker, you should pass "friends".
Listener. This listener is executed upon selecting a friend.
local facebook = require( "facebook" )
local function facebookListener( event )
if ( "session" == event.type ) then
--upon successful login, request list of friends
if ( "login" == event.phase ) then
facebook.showDialog( "apprequests", { message="You should download this game!" } )
end
elseif ( "dialog" == event.type ) then
print( event.response )
end
end
facebook.login( "XXXXXXXXXX", facebookListener ) --replace XXXXXXXXXX with your Facebook App ID
local facebook = require( "facebook" )
local function facebookListener( event )
print( "event.name:", event.name )
print( "event.type:", event.type )
if ( event.data ) then
print( "{" )
for k, v in pairs( event.data ) do
print( k, ":", v )
end
print( "}" )
end
end
-- Show the place picker
facebook.showDialog( "place", { title="Select A Restaurant", longitude=48.857875, latitude=2.294635, searchText="restaurant", resultsLimit=20, radiusInMeters=2000 }, facebookListener )
-- Show the friends picker
facebook.showDialog( "friends", facebookListener )