Difference between revisions of "FBInstant.player.incrementStatsAsync"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2018.3<br/> === Description === <br /> Increment stats saved in the designated cloud storage of the current player.<br /> <br /> <sour...")
 
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(9 intermediate revisions by 3 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 />
 
Increment stats saved in the designated cloud storage of the current player.<br />
 
Increment stats saved in the designated cloud storage of the current player.<br />
<br />
+
<br /></translate>
<source lang="lua">
+
<syntaxhighlight lang="lua">
= FBInstant.player.incrementStatsAsync(keys-value-pairscallback,)
+
FBInstant.player.incrementStatsAsync(keyValuePairs,callback)
</source>
+
</syntaxhighlight>
'''keys-value-pairs:''' (table) A table containing a set of key-value pairs  indicating how much to increment each stat in cloud storage.  The object must contain only numerical values - any non-numerical values will cause the entire modification to be rejected. ''''''<br/>
+
 
'''callback:''' (function) A function that will be called with two arguments: a table which contains the updated key-value pairs for each key specified in the input dictionary or nil if the operation failed, and an error code if the function failed.  NOTE: The table does not necessarily mean that the changes have already been persisted. Rather, it means that the increments were valid and have been scheduled to be performed. It also guarantees that all values that were incremented are now available in player.getStatsAsync. ''''''<br/>
+
=== <translate>Parameters</translate> ===
 +
'''keys-value-pairs''': (table) <translate>A table containing a set of key-value pairs  indicating how much to increment each stat in cloud storage.  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: a table which contains the updated key-value pairs for each key specified in the input dictionary or nil if the operation failed, and an error code if the function failed.  NOTE: The table does not necessarily mean that the changes have already been persisted. Rather, it means that the increments were valid and have been scheduled to be performed. It also guarantees that all values that were incremented are now available in player.getStatsAsync.</translate> <br/>
 +
=== <translate>Examples</translate> ===
 +
'''Example'''<br/>
 +
<syntaxhighlight lang="lua">
 +
FBInstant.player.incrementStatsAsync({level=1,zombiesSlain=17,rank=-1}, function(result,error)
 +
    if result then
 +
print("increments have been made! New values:")
 +
for key,value in pairs(result) do
 +
print(key,value)
 +
end
 +
end
 +
end)
 +
<br/></syntaxhighlight>
 +
 
 +
{{FBInstant.player}}

Latest revision as of 14:29, 13 July 2023


Available since: Gideros 2018.3
Class: Player

Description


Increment stats saved in the designated cloud storage of the current player.

 FBInstant.player.incrementStatsAsync(keyValuePairs,callback)

Parameters

keys-value-pairs: (table) A table containing a set of key-value pairs indicating how much to increment each stat in cloud storage. 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: a table which contains the updated key-value pairs for each key specified in the input dictionary or nil if the operation failed, and an error code if the function failed. NOTE: The table does not necessarily mean that the changes have already been persisted. Rather, it means that the increments were valid and have been scheduled to be performed. It also guarantees that all values that were incremented are now available in player.getStatsAsync.

Examples

Example

FBInstant.player.incrementStatsAsync({level=1,zombiesSlain=17,rank=-1}, function(result,error)
    if result then
		print("increments have been made! New values:")
		for key,value in pairs(result) do
			print(key,value)
		end
	end
end)
<br/>