---
title: ArmaRAMDb - List Set
icon: mdi:file-text-outline
excerpt: Set an element in a list stored at a key in RAMDb.
---

# ramdb_db_fnc_listSet

## Description

Updates or sets the value of a specific element at a given index in a list stored at a specified key in the RAMDb database. This function allows for precise modification of list contents by targeting individual elements without affecting other elements in the list. It is particularly useful for updating record information, modifying configuration data, or correcting entries.

## Syntax

```sqf
[_key, _index, _data] call ramdb_db_fnc_listSet
```

## Parameters

| Parameter | Type | Description | Default |
|-----------|------|-------------|---------|
| _key | String | The key identifying the list in which to set an element | "" |
| _index | Number | The zero-based index of the element to set in the list | -1 |
| _data | Array/String/Number/Boolean | The value to set at the specified index | [] |

## Return Value

None. The operation runs synchronously to update the element immediately.

## Examples

**Update an event log entry:**
```sqf
["eventLog", 0, ["Updated event information"]] call ramdb_db_fnc_listSet;
```

**Modify player statistics:**
```sqf
["playerStats", 3, [name player, score player, alive player]] call ramdb_db_fnc_listSet;
```

**Update configuration in multiplayer:**
```sqf
["missionConfig", 1, ["difficulty", "veteran"]] remoteExecCall ["ramdb_db_fnc_listSet", 2, false];
```

## Notes

- This function updates only the element at the specified index. All other elements remain unchanged.
- The index is zero-based, meaning the first element is at index 0, the second at index 1, and so on.
- If the specified index does not exist in the list, the operation may fail or have no effect.
- Both the `_key` parameter and `_data` parameter must be valid (non-empty string for key, non-nil for data), otherwise the function will exit without performing any action.
- The function supports various data types, including arrays, strings, numbers, and booleans.
- The update operation is permanent and will overwrite any previous value at the specified index.
- All list operations are logged for debugging purposes.

## Related Functions
- `ramdb_db_fnc_listAdd`: Adds an element to a list
- `ramdb_db_fnc_listGet`: Retrieves a specific element from a list
- `ramdb_db_fnc_listLoad`: Retrieves a range of elements from a list
- `ramdb_db_fnc_listRemove`: Removes a specific element from a list
- `ramdb_db_fnc_listDelete`: Deletes an entire list
- `ramdb_db_fnc_scheduler`: Processes the callback from the database extension

## Links

[List Add](listAdd.md) |
[List Delete](listDelete.md) |
[List Get](listGet.md) |
[List Load](listLoad.md) |
[List Remove](listRemove.md) |
[List Set](listSet.md)