Difference between revisions of "FBInstant.player.getConnectedPlayersAsync"
From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2018.3<br/> === Description === <br /> Fetches a table of ConnectedPlayer tables containing information about players that are connect...") |
m (Text replacement - "</source>" to "</syntaxhighlight>") |
||
| (8 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/Player|Player]]<br/> |
| + | === <translate>Description</translate> === | ||
| + | <translate><br /> | ||
Fetches a table of ConnectedPlayer tables containing information about players that are connected to the current player.<br /> | Fetches a table of ConnectedPlayer tables containing information about players that are connected to the current player.<br /> | ||
| − | <br /> | + | <br /></translate> |
| − | < | + | <syntaxhighlight lang="lua"> |
| − | + | FBInstant.player.getConnectedPlayersAsync(callback) | |
| − | </ | + | </syntaxhighlight> |
| − | '''callback | + | === <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. NOTE: This promise will not resolve until FBInstant.startGameAsync() has resolved.</translate> <br/> | ||
| + | === <translate>Examples</translate> === | ||
| + | '''Example 1'''<br/> | ||
| + | <syntaxhighlight lang="lua"> | ||
| + | FBInstant.player.getConnectedPlayersAsync(function(result,error) | ||
| + | if result then | ||
| + | print("Connected 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/></syntaxhighlight> | ||
| + | '''Example 2'''<br/> | ||
| + | <syntaxhighlight lang="lua"> | ||
| + | FBInstant.player.getConnectedPlayersAsync(function(result,error) | ||
| + | if result then | ||
| + | print("Connected 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/></syntaxhighlight> | ||
| + | |||
| + | {{FBInstant.player}} | ||
Latest revision as of 14:29, 13 July 2023
Available since: Gideros 2018.3
Class: Player
Description
Fetches a table of ConnectedPlayer tables containing information about players that are connected to the current player.
FBInstant.player.getConnectedPlayersAsync(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. NOTE: This promise will not resolve until FBInstant.startGameAsync() has resolved.
Examples
Example 1
FBInstant.player.getConnectedPlayersAsync(function(result,error)
if result then
print("Connected 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.player.getConnectedPlayersAsync(function(result,error)
if result then
print("Connected 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/>
- FBInstant.player.canSubscribeBotAsync
- FBInstant.player.flushDataAsync
- FBInstant.player.getConnectedPlayersAsync
- FBInstant.player.getDataAsync
- FBInstant.player.getID
- FBInstant.player.getName
- FBInstant.player.getPhoto
- FBInstant.player.getSignedPlayerInfoAsync
- FBInstant.player.getStatsAsync
- FBInstant.player.incrementStatsAsync
- FBInstant.player.setDataAsync
- FBInstant.player.setStatsAsync
- FBInstant.player.subscribeBotAsync