UpdateData||doc136344

September 20, 2022

Format

GlobalDataStore:UpdateData(key, callback)

Describe

Asynchronously request the value on the key corresponding to the global 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, receiving a parameter

Callback Arguments

Type Describe
variant Data value

Code example

Update the information left by a player of the global data of the "message board".

local messageBoardData = Engine.DataService:GetGlobalDataStore("MessageBoard")
messageBoardData:UpdateData("Player_A", function(msg)
    msg = "I'm the best!!!"
    return msg
end)