Difference between revisions of "FBInstant.context.createAsync"
From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>") |
|||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | '''Available since:''' Gideros 2018.3<br/> | + | <languages /> |
− | === Description === | + | '''<translate>Available since</translate>:''' Gideros 2018.3<br/> |
+ | '''<translate>Class</translate>:''' [[Special:MyLanguage/Context|Context]]<br/> | ||
+ | === <translate>Description</translate> === | ||
<translate><br /> | <translate><br /> | ||
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.<br /> | 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.<br /> | ||
<br /></translate> | <br /></translate> | ||
− | < | + | <syntaxhighlight lang="lua"> |
FBInstant.context.createAsync(id,callback) | FBInstant.context.createAsync(id,callback) | ||
− | </ | + | </syntaxhighlight> |
− | === Parameters === | + | === <translate>Parameters</translate> === |
'''id''': (string) <translate>ID of the player.</translate> <br/> | '''id''': (string) <translate>ID of the player.</translate> <br/> | ||
'''callback''': (function) <translate>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.</translate> <br/> | '''callback''': (function) <translate>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.</translate> <br/> | ||
− | === Examples === | + | === <translate>Examples</translate> === |
'''Example'''<br/> | '''Example'''<br/> | ||
− | < | + | <syntaxhighlight lang="lua"> |
print(FBInstant.context.getID()) -- eg returns 1122334455 | print(FBInstant.context.getID()) -- eg returns 1122334455 | ||
FBInstant.context.createAsync("12345678", function(result,error) | FBInstant.context.createAsync("12345678", function(result,error) | ||
Line 20: | Line 22: | ||
end | end | ||
end) | end) | ||
− | <br/></ | + | <br/></syntaxhighlight> |
+ | |||
+ | {{FBInstant.context}} |
Latest revision as of 14:27, 13 July 2023
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.
FBInstant.context.createAsync(id,callback)
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
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)
<br/>