Difference between revisions of "FBInstant.context.switchAsync"
From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2018.3<br/> === Description === <br /> Request a switch into a specific context. If the player does not have permission to enter that...") |
m (Text replacement - "</source>" to "</syntaxhighlight>") |
||
(7 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/> |
− | <br /> | + | '''<translate>Class</translate>:''' [[Special:MyLanguage/Context|Context]]<br/> |
+ | === <translate>Description</translate> === | ||
+ | <translate><br /> | ||
Request a switch into a specific context. If the player does not have permission to enter that context, or if the player does not provide permission for the game to enter that context, this will reject. Otherwise, the promise will resolve when the game has switched into the specified context.<br /> | Request a switch into a specific context. If the player does not have permission to enter that context, or if the player does not provide permission for the game to enter that context, this will reject. Otherwise, the promise will resolve when the game has switched into the specified context.<br /> | ||
− | <br /> | + | <br /></translate> |
− | < | + | <syntaxhighlight lang="lua"> |
− | + | FBInstant.context.switchAsync(id,callback) | |
− | </ | + | </syntaxhighlight> |
− | '''id | + | === <translate>Parameters</translate> === |
− | '''callback | + | '''id''': (string) <translate>ID of the desired context.</translate> <br/> |
+ | '''callback''': (function) <translate>A function that will be called with two arguments: true when the game has switched into the specified context or nil if the operation failed, and an error code if the function failed.</translate> <br/> | ||
+ | === <translate>Examples</translate> === | ||
+ | '''Example'''<br/> | ||
+ | <syntaxhighlight lang="lua"> | ||
+ | print(FBInstant.context.getID()) -- eg returns 1122334455 | ||
+ | FBInstant.context.switchAsync("1234567890", function(result,error) | ||
+ | if result then | ||
+ | print(FBInstant.context.getID()) -- eg returns 1234567890 | ||
+ | end | ||
+ | end) | ||
+ | <br/></syntaxhighlight> | ||
+ | |||
+ | {{FBInstant.context}} |
Latest revision as of 14:27, 13 July 2023
Available since: Gideros 2018.3
Class: Context
Description
Request a switch into a specific context. If the player does not have permission to enter that context, or if the player does not provide permission for the game to enter that context, this will reject. Otherwise, the promise will resolve when the game has switched into the specified context.
FBInstant.context.switchAsync(id,callback)
Parameters
id: (string) ID of the desired context.
callback: (function) A function that will be called with two arguments: true when the game has switched into the specified 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.switchAsync("1234567890", function(result,error)
if result then
print(FBInstant.context.getID()) -- eg returns 1234567890
end
end)
<br/>