요약
상속된 멤버
코드 샘플
갤러리에서 캡처를 읽고 페이지를 반복합니다
local CaptureService = game:GetService("CaptureService")
local function readCapturesFromGallery()
local allCaptures = {}
local capturesPages
local success, result = pcall(function()
local readResult, pages = CaptureService:ReadCapturesFromGalleryAsync({}, false)
if readResult == Enum.ReadCapturesFromGalleryResult.Success then
capturesPages = pages
end
return readResult
end)
if not success or result ~= Enum.ReadCapturesFromGalleryResult.Success then
-- 권한 오류일 가능성이 높습니다. CaptureService:PromptCaptureGalleryPermissionAsync()를 참조하세요.
warn("초기 캡처를 가져오는 데 실패했습니다: " .. result.Name)
return
end
-- 현재 페이지를 반복합니다
local currentPage = capturesPages:GetCurrentPage()
for _, capture in currentPage do
table.insert(allCaptures, capture)
end
-- 완료될 때까지 다음 페이지로 진행합니다
while not capturesPages.IsFinished do
local advanceToNextPageSuccess, _ = pcall(function()
capturesPages:AdvanceToNextPageAsync()
end)
if not advanceToNextPageSuccess then
return
end
currentPage = capturesPages:GetCurrentPage()
for _, capture in currentPage do
table.insert(allCaptures, capture)
end
end
return allCaptures
end