ArmaDragonflyClient |

Loading...
Searching...
No Matches
listSet

## autotoc_md329

title: ArmaDragonflyClient - List Set icon: mdi:file-text-outline

## excerpt: Set an element in a list stored at a key in DragonflyClient.

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

[_key, _index, _data] call dragonfly_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:

["eventLog", 0, ["Updated event information"]] call dragonfly_db_fnc_listSet;

Modify player statistics:

["playerStats", 3, [name player, score player, alive player]] call dragonfly_db_fnc_listSet;

Update configuration in multiplayer:

["missionConfig", 1, ["difficulty", "veteran"]] remoteExecCall ["dragonfly_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

- `dragonfly_db_fnc_listAdd`: Adds an element to a list
- `dragonfly_db_fnc_listGet`: Retrieves a specific element from a list
- `dragonfly_db_fnc_listLoad`: Retrieves a range of elements from a list
- `dragonfly_db_fnc_listRemove`: Removes a specific element from a list
- `dragonfly_db_fnc_scheduler`: Processes the callback from the database extension

## Links

List Add | List Get | List Load | List Remove | List Set