OrderedDataStore

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

만들 수 없음
복제되지 않음

OrderedDataStore는 일반적으로 GlobalDataStore 와 같지만, 저장된 값이 음수 정수 여야 합니다. 이는 1> Class.OrderedDataStore:GetSortedAsync()|GetSortedAsync()1> 메서드를 사용하여 정렬된 항목을 검사하는

주문된 데이터 저장소는 버전 관리 및 메타데이터를 지원하지 않으므로 DataStoreKeyInfo 는 항상 nil 이 키에 대해 OrderedDataStore 입니다. 버전 관리 및 메타데이터 지원이 필요한 경우 1> Class.DataStore1> 를 사용하십시오.

주문된 데이터 저장소는 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

생성

Class.DataStorePages 개체를 반환합니다. 정렬 순서는 오름차순, 각 페이지의 길이는 페이지 크기 및 1>최소값1> / 4>최대값4> 이상 필터링 하는 옵션 매개 변수입니다.

오류 코드의 요청 제한 및 설명은 데이터 저장소를 참조하십시오.

매개 변수

ascending: bool

반환된 데이터 페이지가 오름차순으로 있는지 여부를 나타내는 부울입니다.

pagesize: number

각 페이지의 길이. 기본적으로 50입니다. 허용되는 최대 값은 100입니다.

minValue: Variant

선택적 매개 변수. 설정하면 minValue 미만의 데이터 페이지가 제외됩니다.

maxValue: Variant

선택적 매개 변수. 설정하면 maxValue 보다 큰 값이 있는 데이터 페이지가 제외됩니다.


반환

제공된 인수에 따라 정렬된 DataStorePages 개체.

이벤트