Difference between revisions of "FBInstant.player.setDataAsync"
m (Text replacement - "</source>" to "</syntaxhighlight>") |
|||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
+ | <languages /> | ||
'''<translate>Available since</translate>:''' Gideros 2018.3<br/> | '''<translate>Available since</translate>:''' Gideros 2018.3<br/> | ||
+ | '''<translate>Class</translate>:''' [[Special:MyLanguage/Player|Player]]<br/> | ||
=== <translate>Description</translate> === | === <translate>Description</translate> === | ||
<translate><br /> | <translate><br /> | ||
Set data to be saved to the designated cloud storage of the current player. The game can store up to 1MB of data for each unique player.<br /> | Set data to be saved to the designated cloud storage of the current player. The game can store up to 1MB of data for each unique player.<br /> | ||
<br /></translate> | <br /></translate> | ||
− | < | + | <syntaxhighlight lang="lua"> |
− | FBInstant.player.setDataAsync( | + | FBInstant.player.setDataAsync(keyValuePairs,callback) |
− | </ | + | </syntaxhighlight> |
+ | |||
=== <translate>Parameters</translate> === | === <translate>Parameters</translate> === | ||
'''keys-value-pairs''': (table) <translate>A table containing a set of key-value pairs that should be persisted to cloud storage. The object must contain only serializable values - any non-serializable 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. The object must contain only serializable values - any non-serializable values will cause the entire modification to be rejected.</translate> <br/> | ||
Line 13: | Line 16: | ||
=== <translate>Examples</translate> === | === <translate>Examples</translate> === | ||
'''Example'''<br/> | '''Example'''<br/> | ||
− | < | + | <syntaxhighlight lang="lua"> |
FBInstant.player.setDataAsync({achievements={"medal1","medal2","medal3"},currentLife=300}, function(result,error) | FBInstant.player.setDataAsync({achievements={"medal1","medal2","medal3"},currentLife=300}, function(result,error) | ||
if result then | if result then | ||
Line 19: | Line 22: | ||
end | end | ||
end) | end) | ||
− | <br/></ | + | <br/></syntaxhighlight> |
+ | |||
+ | {{FBInstant.player}} |
Latest revision as of 14:29, 13 July 2023
Available since: Gideros 2018.3
Class: Player
Description
Set data to be saved to the designated cloud storage of the current player. The game can store up to 1MB of data for each unique player.
FBInstant.player.setDataAsync(keyValuePairs,callback)
Parameters
keys-value-pairs: (table) A table containing a set of key-value pairs that should be persisted to cloud storage. The object must contain only serializable values - any non-serializable 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.setDataAsync({achievements={"medal1","medal2","medal3"},currentLife=300}, function(result,error)
if result then
print("data is set")
end
end)
<br/>
- FBInstant.player.canSubscribeBotAsync
- FBInstant.player.flushDataAsync
- FBInstant.player.getConnectedPlayersAsync
- FBInstant.player.getDataAsync
- FBInstant.player.getID
- FBInstant.player.getName
- FBInstant.player.getPhoto
- FBInstant.player.getSignedPlayerInfoAsync
- FBInstant.player.getStatsAsync
- FBInstant.player.incrementStatsAsync
- FBInstant.player.setDataAsync
- FBInstant.player.setStatsAsync
- FBInstant.player.subscribeBotAsync