> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ILampArray::GetIndicesForPurposes method

> Fills a caller-provided buffer with Lamp indices matching the given LampPurposes; size the buffer first with GetIndicesCountForPurposes.

# ILampArray::GetIndicesForPurposes

Populates a buffer of Lamp indices that support a given set of LampPurposes. Prior to calling this method, the maximum buffer size should be obtained by calling [ILampArray::GetIndicesCountForPurposes](/reference/lighting/lamparray/interfaces/ilamparray/methods/ilamparray_getindicescountforpurposes).

## Syntax

```cpp theme={null}
void GetIndicesForPurposes(
    LampPurposes lampPurposes,
    uint32_t lampIndicesCount,
    uint32_t * lampIndices)
```

### Parameters

*lampPurposes*
Type: [LampPurposes](/reference/lighting/lamparray/enums/lamppurposes)

The desired set of LampPurposes.

*lampIndicesCount*\
Type: uint32\_t

The size of the buffer to populate.

*lampIndices*  \_Out\_writes\_(lampIndicesCount)
Type: uint32\_t\*

The Lamp indices buffer. Indices written into the buffer are for Lamps that match all of the flags in lampPurposes.

### Return value

Type: void

## Remarks

The following code demonstrates how to set a color for all branding Lamps on an ILampArray:

```cpp theme={null}
void UpdateBrandingLamps(ILampArray* lampArray)
{
    // Get the number of Branding lamps
    LampPurposes purposes = LampPurposes::Branding;
    uint32_t indicesCount = lampArray->GetIndicesCountForPurposes(purposes);

    // Allocate and populate a buffer with the indices of those Lamps
    std::vector<uint32_t> indicesBuffer(indicesCount);
    lampArray->GetIndicesForPurposes(purposes, indicesCount, indicesBuffer.data());

    // Set color for all Branding Lamps to red.
    std::vector<LampArrayColor> colorsBuffer(indicesCount);
    for (uint32_t i = 0; i < indicesCount; i++)
    {
        colorsBuffer[i] = { 0xFF /* r */, 0x0 /* g */, 0x0 /* b */, 0xFF /* a */ };
    }

    lampArray->SetColorsForIndices(indicesCount, indicesBuffer.data(), colorsBuffer.data());
}
```

## Requirements

**Header:** LampArray.h

**Library:** xgameplatform.lib

**Supported platforms:** XBOX One family consoles and XBOX Series consoles

## See also

[Lighting API Overview](/build/core-features/common/lighting/gc-lighting-toc)\
[ILampArray::GetIndicesCountForPurposes](/reference/lighting/lamparray/interfaces/ilamparray/methods/ilamparray_getindicescountforpurposes)\
[ILampArray::SetColorsForIndices](/reference/lighting/lamparray/interfaces/ilamparray/methods/ilamparray_setcolorsforindices)\
[ILampArray](/reference/lighting/lamparray/interfaces/ilamparray/ilamparray)


## Related topics

- [ILampArray::GetIndicesCountForPurposes method](/reference/lighting/lamparray/interfaces/ilamparray/methods/ilamparray_getindicescountforpurposes.md)
- [ILampArray::GetLampInfo method](/reference/lighting/lamparray/interfaces/ilamparray/methods/ilamparray_getlampinfo.md)
- [ILampArray::GetLampCount method](/reference/lighting/lamparray/interfaces/ilamparray/methods/ilamparray_getlampcount.md)
- [ILampArray::SetColorsForIndices method](/reference/lighting/lamparray/interfaces/ilamparray/methods/ilamparray_setcolorsforindices.md)
- [ILampArray::GetLampArrayKind method](/reference/lighting/lamparray/interfaces/ilamparray/methods/ilamparray_getlamparraykind.md)
