RequestData||doc136342

September 20, 2022

Format

GlobalDataStore:RequestData(key, callback)

Describe

Asynchronously request the value on the key corresponding to the global data, pass the value in and execute the callback function.

parameter

Variable name Type Describe
key string key
callback function Callback function, receiving a parameter

Callback Arguments

Type Describe
variant Data value

Code example

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

local messageBoardData = Engine.DataService:GetGlobalDataStore("MessageBoard")
messageBoardData:RequestData("Player_A", function(msg)
    print("Player_A left message:", msg)
end)