ramdb/docs/list/listRemove.md
Jacob Schmidt 8c0e8144e5 docs: Update documentation links and function references
This commit updates the documentation to reflect the current function names and link structure. Specifically, it addresses the following:

*   Corrected internal links within the documentation to point to the correct markdown files (e.g., `hashDelete.md` instead of `hashDelete`).
*   Updated related function references to reflect the current function names and include missing functions.
*   Removed outdated function references.
*   Added `ramdb_db_fnc_scheduler` to related functions where appropriate.
*   Updated the links section to use the correct markdown file names.
2025-03-22 16:53:30 -05:00

72 lines
2.5 KiB
Markdown

---
title: ArmaRAMDb - List Remove
icon: mdi:file-text-outline
excerpt: Remove an element from a list stored at a key in RAMDb.
---
# ramdb_db_fnc_listRemove
## Description
Removes a specific element from a list stored at a specified key in the RAMDb 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
```sqf
[_key, _index] call ramdb_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:**
```sqf
["eventLog", 0] call ramdb_db_fnc_listRemove;
```
**Remove a specific player record:**
```sqf
["playerRecords", 5] call ramdb_db_fnc_listRemove;
```
**Remove an element from a multiplayer environment:**
```sqf
["sharedData", 2] remoteExecCall ["ramdb_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
- `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_listSet`: Replaces a specific element in 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)