# 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

`boolean`

Returns whether it is the last page.

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

#### Code Samples

```lua
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

### 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

```lua
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
```

### 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

#### Return

| `Value` | The information configured in the current page. |
| ------- | ----------------------------------------------- |

#### Code Samples

```lua
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
```

## Events


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.overdare.com/development/api-reference/classes/pages.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
