Pages

Pages : Instance

Overview

The Pages object is used to provide large data divided into multiple pages.

Each page consists of a list of key-value pairs sorted in order.

Properties

IsFinished

bool

Returns whether it is the last page.

This determines whether it is possible to request the next page while iterating through pages.

Code Samples

local MarketplaceService = game:GetService("MarketplaceService")

local function Request_GetWorldProductsAsync()
    local success, errorOrWorldProducts = pcall(function()
        return MarketplaceService:GetWorldProductsAsync()
    end) 
    
    if success then
        local worldProducts = errorOrWorldProducts
			
        while true do
            local currentPage = worldProducts:GetCurrentPage()	
		    
            -- Exit loop if it's the last page
            if worldProducts.IsFinished or currentPage == nil then         	
                break
            end
        end
    end
end

Methods

GetCurrentPage

Returns all items included in the current page.

The key structure of the returned items varies depending on the data from which the Pages object was created.

Parameters

Array

The information configured in the current page.

Code Samples

local MarketplaceService = game:GetService("MarketplaceService")

local function Request_GetWorldProductsAsync()
    local success, errorOrWorldProducts = pcall(function()
        return MarketplaceService:GetWorldProductsAsync()
    end) 
    
    if success then
        local worldProducts = errorOrWorldProducts
        
        while true do
            local currentPage = worldProducts:GetCurrentPage()
        
            if currentPage ~= nil then
                for _, productInfo in pairs(currentPage) do	
                    print("World Product Name: " .. tostring(productInfo.Name))  
                end	
            end
        end
    end
end

AdvanceToNextPageAsync

Moves to the next page while iterating through the Pages object.

However, page transitions are processed only if there are remaining pages.

Parameters

Return

void

Code Samples

local MarketplaceService = game:GetService("MarketplaceService")

local function Request_GetWorldProductsAsync()
    local success, errorOrWorldProducts = pcall(function()
        return MarketplaceService:GetWorldProductsAsync()
    end) 
    
    if success then
        local worldProducts = errorOrWorldProducts
			
        while true do
            local currentPage = worldProducts:GetCurrentPage()	
		    
            -- Exit loop if it's the last page
            if worldProducts.IsFinished or currentPage == nil then         	
                break
            else
                worldProducts:AdvanceToNextPageAsync()
            end
        end
    end
end

Events

Last updated