OrderedDataStore
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
A 注文されたデータストア は、保存された値が GlobalDataStore であることを除いて、基本的に **** です。それは、 オブジェクトを使用して、ソート済みのエントリを検査できる方法を露出します。
順序付けられたデータストアはバージョン管理とメタデータをサポートしていないので、DataStoreKeyInfo は常にnilでキーが含まれるOrderedDataStoreです。バージョン管理とメタデータサポートが必要な場合は、DataStore を使用します。
順序付けられたデータストアは、userIds または SetAsync() または IncrementAsync() のオプションパラメータをサポートしません。
データストア で、順序付けられたデータストアの使用に関する概要を見る。
コードサンプル
This code sample demonstrates usage of an OrderedDataStore and pages.
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()
概要
方法
- GetSortedAsync(ascending : boolean,pagesize : number,minValue : Variant,maxValue : Variant):DataStorePages
返すオブジェクト DataStorePages 。
指定されたデータストアと DataStoreKeyInfo インスタンスのキーの値を返します。
- IncrementAsync(key : string,delta : number,userIds : Array,options : DataStoreIncrementOptions):Variant
提供された量でキーの値を増加させます (両方が整数である必要があります)。
指定されたキーを削除しながら、アクセシブルバージョンを保持します。
指定されたキーのためのデータストアの値を設定します。
指定された呼び出し機能から新しい値でキーの値を更新します。
プロパティ
方法
GetSortedAsync
返すオブジェクト DataStorePages 。ソート順序は 上昇順 、各ページの長さは ページサイズ 、そして minValue / maxValue は結果をフィルタするオプションパラメータです。
データストア でリクエスト制限とエラーコードの説明を見てください。
パラメータ
返されたデータページが上昇順序かどうかを示すブール。
各ページの長さ。デフォルトは 50です。最大許可値は 100です。
オプションパラメータ。設定された場合、値が minValue 未満のデータページが除外されます。
オプションパラメータ。設定された場合、値が maxValue より大きいデータページが除外されます。
戻り値
提供された引数に基づいてソートされた DataStorePages オブジェクト。