OrderedDataStore

非推奨を表示

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。

作成できません
複製されていません

A 注文されたデータストア は、保存された値が GlobalDataStore であることを除いて、基本的に **** です。それは、 オブジェクトを使用して、ソート済みのエントリを検査できる方法を露出します。

順序付けられたデータストアはバージョン管理とメタデータをサポートしていないので、DataStoreKeyInfo は常にnilでキーが含まれるOrderedDataStoreです。バージョン管理とメタデータサポートが必要な場合は、DataStore を使用します。

順序付けられたデータストアは、userIds または SetAsync() または IncrementAsync() のオプションパラメータをサポートしません。

データストア で、順序付けられたデータストアの使用に関する概要を見る。

コードサンプル

This code sample demonstrates usage of an OrderedDataStore and pages.

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()

概要

方法

GlobalDataStore から継承した 方法

プロパティ

方法

GetSortedAsync

イールド

返すオブジェクト DataStorePages 。ソート順序は 上昇順 、各ページの長さは ページサイズ 、そして minValue / maxValue は結果をフィルタするオプションパラメータです。

データストア でリクエスト制限とエラーコードの説明を見てください。

パラメータ

ascending: boolean

返されたデータページが上昇順序かどうかを示すブール。

既定値: ""
pagesize: number

各ページの長さ。デフォルトは 50です。最大許可値は 100です。

既定値: ""
minValue: Variant

オプションパラメータ。設定された場合、値が minValue 未満のデータページが除外されます。

既定値: ""
maxValue: Variant

オプションパラメータ。設定された場合、値が maxValue より大きいデータページが除外されます。

既定値: ""

戻り値

提供された引数に基づいてソートされた DataStorePages オブジェクト。

イベント