Informacje o wersji
Edukacja
Klasa silnika
DataStore
Brak możliwości tworzenia
Bez replikacji

*Ta zawartość została przetłumaczona przy użyciu narzędzi AI (w wersji beta) i może zawierać błędy. Aby wyświetlić tę stronę w języku angielskim, kliknij tutaj.


Podsumowanie
Metody
ListKeysAsync(prefix: string,pageSize: number,cursor: string,excludeDeleted: boolean):DataStoreKeyPages
ListVersionsAsync(key: string,sortDirection: Enum.SortDirection,minDate: number,maxDate: number,pageSize: number):DataStoreVersionPages
RemoveVersionAsync(key: string,version: string):()
Przestarzałe
Członkowie odziedziczeni

Materiały referencyjne dotyczące interfejsów API
Metody
GetVersionAsync
Wynik
Możliwości: DataStore
DataStore:GetVersionAsync(
key:string, version:string
Parametry
key:string
version:string
Zwroty

GetVersionAtTimeAsync
Wynik
Możliwości: DataStore
DataStore:GetVersionAtTimeAsync(
key:string, timestamp:number
Parametry
key:string
timestamp:number
Zwroty
Przykłady kodu
Pobieranie wersji DataStore według czasu
local DataStoreService = game:GetService("DataStoreService")
local dataStore = DataStoreService:GetDataStore("DataStore")
local key = "key-123"
function setData(data)
local success, result = pcall(function()
dataStore:SetAsync(key, data)
end)
if not success then
warn(result)
end
end
function getVersionAtTime(timestamp)
local success, result, keyInfo = pcall(function()
return dataStore:GetVersionAtTimeAsync(key, timestamp.UnixTimestampMillis)
end)
if success then
if result == nil then
print("Nie znaleziono wersji o tej porze")
else
print(result, keyInfo.Version)
end
else
warn(result)
end
end
-- Wcześniej uruchomiono o 2024/12/02 6:00 UTC
setData("wersja 1")
-- Wcześniej uruchomiono o 2024/12/02 9:00 UTC
setData("wersja 2")
-- Wyświetla "Nie znaleziono wersji o tej porze"
local time1 = DateTime.fromUniversalTime(2024, 12, 02, 05, 00)
getVersionAtTime(time1)
-- Wyświetla "wersja 1 <version>"
local time2 = DateTime.fromUniversalTime(2024, 12, 02, 07, 00)
getVersionAtTime(time2)
-- Wyświetla "wersja 2 <version>"
local time3 = DateTime.fromUniversalTime(2024, 12, 02, 10, 00)
getVersionAtTime(time3)

ListKeysAsync
Wynik
Możliwości: DataStore
DataStore:ListKeysAsync(
prefix:string, pageSize:number, cursor:string, excludeDeleted:boolean
Parametry
prefix:string
pageSize:number
Wartość domyślna: 0
cursor:string
excludeDeleted:boolean
Wartość domyślna: false

ListVersionsAsync
Wynik
Możliwości: DataStore
DataStore:ListVersionsAsync(
key:string, sortDirection:Enum.SortDirection, minDate:number, maxDate:number, pageSize:number
Parametry
key:string
sortDirection:Enum.SortDirection
Wartość domyślna: "Ascending"
minDate:number
Wartość domyślna: 0
maxDate:number
Wartość domyślna: 0
pageSize:number
Wartość domyślna: 0
Przykłady kodu
Pobieranie wersji DataStore z filtrem daty
local DataStoreService = game:GetService("DataStoreService")
local experienceStore = DataStoreService:GetDataStore("PlayerExperience")
local time = DateTime.fromUniversalTime(2020, 10, 09, 01, 42)
local listSuccess, pages = pcall(function()
return experienceStore:ListVersionsAsync("User_1234", nil, time.UnixTimestampMillis)
end)
if listSuccess then
local items = pages:GetCurrentPage()
for key, info in pairs(items) do
print("Klucz:", key, "; Wersja:", info.Version, "; Utworzono:", info.CreatedTime, "; Usunięto:", info.IsDeleted)
end
end

RemoveVersionAsync
Przestarzałe

©2026 Roblox Corporation. Nazwa Roblox, logo Roblox oraz hasło „Powering Imagination” należą do naszych zarejestrowanych i niezarejestrowanych znaków towarowych na terenie Stanów Zjednoczonych oraz w innych krajach.