FBInstant.player.getStatsAsync: Difference between revisions

From GiderosMobile
No edit summary
m Text replacement - "<source" to "<syntaxhighlight"
Line 7: Line 7:
Retrieve stats from the designated cloud storage of the current player.<br />
Retrieve stats from the designated cloud storage of the current player.<br />
<br /></translate>
<br /></translate>
<source lang="lua">
<syntaxhighlight lang="lua">
  FBInstant.player.getStatsAsync(keys,callback)
  FBInstant.player.getStatsAsync(keys,callback)
</source>
</source>
Line 15: Line 15:
=== <translate>Examples</translate> ===
=== <translate>Examples</translate> ===
'''Example'''<br/>
'''Example'''<br/>
<source lang="lua">
<syntaxhighlight lang="lua">
FBInstant.player.getDataAsync({"level","zombiesSlain"}, function(result,error)
FBInstant.player.getDataAsync({"level","zombiesSlain"}, function(result,error)
     if result then
     if result then

Revision as of 13:28, 13 July 2023


Available since: Gideros 2018.3
Class: Player

Description


Retrieve stats from the designated cloud storage of the current player.

<syntaxhighlight lang="lua">

FBInstant.player.getStatsAsync(keys,callback)

</source>

Parameters

keys: (table) An optional table of unique keys to retrieve stats for. If the function is called with it nil, it will fetch all stats.
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
<syntaxhighlight lang="lua"> FBInstant.player.getDataAsync({"level","zombiesSlain"}, function(result,error)

   if result then

print("stats are loaded") for key,value in pairs(result) do print(key,value) end end end)
</source>