Difference between revisions of "FBInstant.context.getPlayersAsync"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 +
<languages />
 
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
 
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
 +
'''<translate>Class</translate>:''' [[Special:MyLanguage/Context|Context]]<br/>
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
 
<translate><br />
 
<translate><br />
 
Gets an table of #contextplayer tables containing information about active players (people who played the game in the last 90 days) that are associated with the current context. This may include the current player.<br />
 
Gets an table of #contextplayer tables containing information about active players (people who played the game in the last 90 days) that are associated with the current context. This may include the current player.<br />
 
<br /></translate>
 
<br /></translate>
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
  FBInstant.context.getPlayersAsync(callback)
 
  FBInstant.context.getPlayersAsync(callback)
</source>
+
</syntaxhighlight>
 
=== <translate>Parameters</translate> ===
 
=== <translate>Parameters</translate> ===
 
'''callback''': (function) <translate>A function that will be called with two arguments: a set of key-value pairs or nil is 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: a set of key-value pairs or nil is the operation failed, and an error code if the function failed.</translate> <br/>
 
=== <translate>Examples</translate> ===
 
=== <translate>Examples</translate> ===
 
'''Example 1'''<br/>
 
'''Example 1'''<br/>
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
FBInstant.context.getPlayersAsync(function(result,error)
 
FBInstant.context.getPlayersAsync(function(result,error)
 
     if result then
 
     if result then
Line 24: Line 26:
 
end
 
end
 
end)
 
end)
<br/></source>
+
<br/></syntaxhighlight>
 
'''Example 2'''<br/>
 
'''Example 2'''<br/>
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
FBInstant.context.getPlayersAsync(function(result,error)
 
FBInstant.context.getPlayersAsync(function(result,error)
 
     if result then
 
     if result then
Line 36: Line 38:
 
end
 
end
 
end)
 
end)
<br/></source>
+
<br/></syntaxhighlight>
 +
 
 +
{{FBInstant.context}}

Latest revision as of 14:27, 13 July 2023


Available since: Gideros 2018.3
Class: Context

Description


Gets an table of #contextplayer tables containing information about active players (people who played the game in the last 90 days) that are associated with the current context. This may include the current player.

 FBInstant.context.getPlayersAsync(callback)

Parameters

callback: (function) A function that will be called with two arguments: a set of key-value pairs or nil is the operation failed, and an error code if the function failed.

Examples

Example 1

FBInstant.context.getPlayersAsync(function(result,error)
    if result then
		print("Active players:",#result)
		for loop=1,#result do
			local player=result[loop]
			for key,value in pairs(player) do
				print(key,value)
			end
		end
	end
end)
<br/>

Example 2

FBInstant.context.getPlayersAsync(function(result,error)
    if result then
		print("Active players:",#result)
		for loop=1,#result do
			local player=result[loop]
			print("id,name,photo",player.getID(),player.getName(),player.getPhoto())
		end
	end
end)
<br/>