OrderedDataStore

사용되지 않는 항목 표시

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

만들 수 없음
복제되지 않음

A 정렬된 데이터 저장소 는 저장된 값이 양의 정수여야 한다는 점을 제외하고 기본적으로 와 동일합니다.정렬된 순서로 항목을 검사할 수 있는 메서드 GetSortedAsync() 를 노출하며, 이 메서드는 DataStorePages 개체를 사용합니다.

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

정렬된 데이터 저장소는 userIds 또는 IncrementAsync()에 대한 선택적 SetAsync() 매개 변수를 지원하지 않습니다.

주문형 데이터 저장소 사용에 대한 개요는 데이터 저장소를 참조하십시오.

코드 샘플

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

선택적 매개 변수. 설정되면 값이 분 이하 인 데이터 페이지가 제외됩니다.

기본값: ""
maxValue: Variant

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

기본값: ""

반환

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

이벤트