Difference between revisions of "FBInstant.player.getStatsAsync"
From GiderosMobile
Line 8: | Line 8: | ||
FBInstant.player.getStatsAsync(keys,callback) | FBInstant.player.getStatsAsync(keys,callback) | ||
</source> | </source> | ||
− | '''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. | + | === 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. ''''''<br/> | + | '''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. <br/> |
+ | '''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. <br/> | ||
+ | === Examples === | ||
+ | '''Example'''<br/> | ||
+ | <source lang="lua"><br /> | ||
+ | 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/></source> |
Revision as of 10:40, 23 August 2018
Available since: Gideros 2018.3
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
<br />
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/>