RequestRangeData||doc136348

September 20, 2022

Format

RankDataStore:RequestRangeData(beginIndex, endIndex, callback)

Describe

Asynchronously request leaderboard data to specify the data within the ranking range. The ranking is sorted from large to small according to the value of the data. The data list within the range is passed in and the callback function is executed.

parameter

Variable name Type Describe
beginIndex int Start index
endIndex int End index
callback function Callback Function

Callback Arguments

Type Describe
table<string, int> Leaderboard data key value pair list

Code example

Obtain the combat effectiveness data of the top 5 players in the "player combat effectiveness" ranking list.

local playerPowerData = Engine.DataService:GetRankDataStore("PlayerPower")
playerPowerData:RequestRangeData(1, 5, function(powerDataList)
    for index, data in ipairs(powerDataList) do
        print(index, data.key, data.value)
    end
end)