ArmaDragonflyClient |

Loading...
Searching...
No Matches
listRemove

## autotoc_md318

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

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

# dragonfly_db_fnc_listRemove

## Description

Removes a specific element from a list stored at a specified key in the DragonflyClient database. This function allows for precise control over list content by targeting individual elements by their index, without affecting other elements in the list. This is particularly useful for removing outdated or no longer needed entries.

## Syntax

[_key, _index] call dragonfly_db_fnc_listRemove

## Parameters

Parameter | Type | Description | Default
--- | --- | --- | ---
_key | String | The key identifying the list from which to remove an element | ""
_index | Number | The zero-based index of the element to remove from the list | -1

## Return Value

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

## Examples

Remove the first element from an event log:

["eventLog", 0] call dragonfly_db_fnc_listRemove;

Remove a specific player record:

["playerRecords", 5] call dragonfly_db_fnc_listRemove;

Remove an element from a multiplayer environment:

["sharedData", 2] remoteExecCall ["dragonfly_db_fnc_listRemove", 2, false];

## Notes

- This function removes only the element at the specified index. All other elements remain unchanged, though their indices may shift.
- The index is zero-based, meaning the first element is at index 0, the second at index 1, and so on.
- If an invalid index is provided (negative or exceeding the list length), the operation will not remove any elements.
- The `_key` parameter must be a non-empty string, otherwise the function will exit without performing any action.
- After removing an element, all subsequent elements shift down by one index to maintain a contiguous list.
- The removal operation is permanent and cannot be undone except by re-adding the element.
- 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_listSet`: Replaces a specific element in a list
- `dragonfly_db_fnc_scheduler`: Processes the callback from the database extension

## Links

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