FBInstant.context.createAsync

From GiderosMobile
Revision as of 14:26, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")


Available since: Gideros 2018.3
Class: Context

Description


Attempts to create or switch into a context between a specified player and the current player. The returned promise will reject if the player listed is not a Connected Player of the current player or if the player does not provide permission to enter the new context. Otherwise, the promise will resolve when the game has switched into the new context.

<syntaxhighlight lang="lua">

FBInstant.context.createAsync(id,callback)

</source>

Parameters

id: (string) ID of the player.
callback: (function) A function that will be called with two arguments: true when the game has switched into the new context or nil if the operation failed, and an error code if the function failed.

Examples

Example
<syntaxhighlight lang="lua"> print(FBInstant.context.getID()) -- eg returns 1122334455 FBInstant.context.createAsync("12345678", function(result,error)

   if result then

print(FBInstant.context.getID()) -- eg returns 5544332211 end end)
</source>