DataStorePages

แสดงที่เลิกใช้งานแล้ว

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่

ไม่สามารถสร้าง
ไม่ซ้ำ

ประเภทพิเศษของวัตถุ Pages ที่หน้ามีคู่กุญแจ/ค่าจาก OrderedDataStore .สำหรับวัตถุนี้ GetCurrentPage() จะคืนเป็นคอลเลกชันของตารางที่มีกุญแจชื่อว่า key และ value ซึ่งสะท้อนข้อมูลคู่กุญแจ/ค่า

ตัวอย่างโค้ด

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
  • คืนรายการบนหน้าปัจจุบัน คีย์ในรายการจะถูกกำหนดโดยแหล่งของวัตถุนี้

  • ผลตอบแทน

    จัดเตรียมการไปยังหน้าต่อไปในวัตถุหน้าหากเป็นไปได้

คุณสมบัติ

วิธีการ

อีเวนต์