Difference between revisions of "FBInstant.player.setStatsAsync"

From GiderosMobile
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
'''Available since:''' Gideros 2018.3<br/>
+
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
=== Description ===
+
=== <translate>Description</translate> ===
 
<translate><br />
 
<translate><br />
 
Set stats to be saved to the designated cloud storage of the current player.<br />
 
Set stats to be saved to the designated cloud storage of the current player.<br />
Line 8: Line 8:
 
  FBInstant.player.setStatsAsync(keys-value-pairs,callback)
 
  FBInstant.player.setStatsAsync(keys-value-pairs,callback)
 
</source>
 
</source>
=== Parameters ===
+
=== <translate>Parameters</translate> ===
 
'''keys-value-pairs''': (table) <translate>A table containing a set of key-value pairs that should be persisted to cloud storage as stats, which can be surfaced or used in a variety of ways to benefit player engagement. The object must contain only numerical values - any non-numerical values will cause the entire modification to be rejected.</translate> <br/>
 
'''keys-value-pairs''': (table) <translate>A table containing a set of key-value pairs that should be persisted to cloud storage as stats, which can be surfaced or used in a variety of ways to benefit player engagement. The object must contain only numerical values - any non-numerical values will cause the entire modification to be rejected.</translate> <br/>
 
'''callback''': (function) <translate>A function that will be called with two arguments: true or nil if the operation failed, and an error code if the function failed.  NOTE: True does not necessarily mean that the input has already been persisted. Rather, it means that the data was valid and has been scheduled to be saved. It also guarantees that all values that were set are now available in player.getDataAsync</translate> <br/>
 
'''callback''': (function) <translate>A function that will be called with two arguments: true or nil if the operation failed, and an error code if the function failed.  NOTE: True does not necessarily mean that the input has already been persisted. Rather, it means that the data was valid and has been scheduled to be saved. It also guarantees that all values that were set are now available in player.getDataAsync</translate> <br/>
=== Examples ===
+
=== <translate>Examples</translate> ===
 
'''Example'''<br/>
 
'''Example'''<br/>
 
<source lang="lua">
 
<source lang="lua">

Revision as of 07:27, 24 August 2018

Available since: Gideros 2018.3

Description


Set stats to be saved to the designated cloud storage of the current player.

 FBInstant.player.setStatsAsync(keys-value-pairs,callback)

Parameters

keys-value-pairs: (table) A table containing a set of key-value pairs that should be persisted to cloud storage as stats, which can be surfaced or used in a variety of ways to benefit player engagement. The object must contain only numerical values - any non-numerical values will cause the entire modification to be rejected.
callback: (function) A function that will be called with two arguments: true or nil if the operation failed, and an error code if the function failed. NOTE: True does not necessarily mean that the input has already been persisted. Rather, it means that the data was valid and has been scheduled to be saved. It also guarantees that all values that were set are now available in player.getDataAsync

Examples

Example

FBInstant.player.setStatsAsync({level=5,zombiesSlain=27}, function(result,error)
    if result then
		print("data is set")
	end
end)
<br/>