DataStorePages

사용되지 않는 항목 표시

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

만들 수 없음
복제되지 않음

페이지에 키/값 쌍이 포함된 특수 유형의 Pages 개체입니다. 해당 페이지는 OrderedDataStore에서 나옵니다.이 개체에 대해 GetCurrentPage() 는 키가 keyvalue 로 명명된 배열의 배열을 반환하며, 이는 키/값 쌍 데이터를 반영합니다.

코드 샘플

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

요약

속성

속성Pages에서 상속되었습니다
  • 읽기 전용
    복제되지 않음
    병렬 읽기

    현재 페이지가 마지막 페이지인지 여부.

메서드

메서드Pages에서 상속되었습니다
  • 현재 페이지의 항목을 반환합니다. 항목의 키는 이 개체의 소스에 의해 결정됩니다.

  • 가능하면 페이지 개체의 다음 페이지로 반복합니다.

속성

메서드

이벤트