Difference between revisions of "FBInstant.player.getStatsAsync"

From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight")
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
Line 9: Line 9:
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
  FBInstant.player.getStatsAsync(keys,callback)
 
  FBInstant.player.getStatsAsync(keys,callback)
</source>
+
</syntaxhighlight>
 
=== <translate>Parameters</translate> ===
 
=== <translate>Parameters</translate> ===
 
'''keys''': (table) <translate>An optional table of unique keys to retrieve stats for. If the function is called with it nil, it will fetch all stats.</translate> <br/>
 
'''keys''': (table) <translate>An optional table of unique keys to retrieve stats for. If the function is called with it nil, it will fetch all stats.</translate> <br/>
Line 24: Line 24:
 
end
 
end
 
end)
 
end)
<br/></source>
+
<br/></syntaxhighlight>
  
 
{{FBInstant.player}}
 
{{FBInstant.player}}

Latest revision as of 14:29, 13 July 2023


Available since: Gideros 2018.3
Class: Player

Description


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

 FBInstant.player.getStatsAsync(keys,callback)

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

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)
<br/>