Difference between revisions of "FBInstant.context.switchAsync"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
 
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 /></translate>
 
<br /></translate>
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
  FBInstant.context.switchAsync(id,callback)
 
  FBInstant.context.switchAsync(id,callback)
</source>
+
</syntaxhighlight>
 
=== <translate>Parameters</translate> ===
 
=== <translate>Parameters</translate> ===
 
'''id''': (string) <translate>ID of the desired context.</translate> <br/>
 
'''id''': (string) <translate>ID of the desired context.</translate> <br/>
Line 15: Line 15:
 
=== <translate>Examples</translate> ===
 
=== <translate>Examples</translate> ===
 
'''Example'''<br/>
 
'''Example'''<br/>
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
print(FBInstant.context.getID()) -- eg returns 1122334455
 
print(FBInstant.context.getID()) -- eg returns 1122334455
 
FBInstant.context.switchAsync("1234567890", function(result,error)
 
FBInstant.context.switchAsync("1234567890", function(result,error)
Line 22: Line 22:
 
end
 
end
 
end)
 
end)
<br/></source>
+
<br/></syntaxhighlight>
  
 
{{FBInstant.context}}
 
{{FBInstant.context}}

Latest revision as of 15: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/>