UpdateData||doc136349

September 20, 2022

Format

RankDataStore:UpdateData(key, callback)

Describe

Asynchronously request the value on the key corresponding to the leaderboard data, transfer the value to and execute the callback function, and set the new value returned by the callback function to the key.

parameter

Variable name Type Describe
key string key
callback function Callback Function

Callback Arguments

Type Describe
variant Data value

Code example

Update the combat effectiveness data of a player in the "player combat effectiveness" leaderboard data.

local playerPowerData = Engine.DataService:GetRankDataStore("PlayerPower")
playerPowerData:UpdateData("Player_A", function(power)
    power = power * 2
    return power
end)