DataStorePages
非推奨を表示
作成できません
複製されていません
A special type of Pages object whose pages contain key/value pairs from an OrderedDataStore. For this object, GetCurrentPage() returns an array of tables, each containing keys named key and value; these reflect the key/value pair data.
コードサンプル
OrderedDataStore Basics
local DataStoreService = game:GetService("DataStoreService")
local pointsStore = DataStoreService:GetOrderedDataStore("Points")
local function printTopTenPlayers()
local isAscending = false
local pageSize = 10
local pages = pointsStore:GetSortedAsync(isAscending, pageSize)
local topTen = pages:GetCurrentPage()
-- The data in 'topTen' is stored with the index being the index on the page
-- For each item, 'data.key' is the key in the OrderedDataStore and 'data.value' is the value
for rank, data in ipairs(topTen) do
local name = data.key
local points = data.value
print(name .. " is ranked #" .. rank .. " with " .. points .. "points")
end
-- Potentially load the next page...
--pages:AdvanceToNextPageAsync()
end
-- Create some data
pointsStore:SetAsync("Alex", 55)
pointsStore:SetAsync("Charley", 32)
pointsStore:SetAsync("Sydney", 68)
-- Display the top ten players
printTopTenPlayers()
概要
プロパティ
Pages から継承した プロパティ- 読み取り専用複製されていません並列読み取り
Whether or not the current page is the last page available.
方法
Pages から継承した 方法Returns the items on the current page. The keys in the item are determined by the source of this object.
- イールド
Iterates to the next page in the pages object, if possible.
プロパティ
プロパティ は Pages から継承されました
方法
プロパティ は Pages から継承されました