ramdb/docs/list/listGet.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

71 lines
3.0 KiB
Markdown

---
title: ArmaRAMDb - List Get
icon: mdi:file-text-outline
excerpt: Get element of list stored at key from RAMDb.
---
# ramdb_db_fnc_listGet
## Description
Retrieves a specific element from a list stored in the database by its index. This function accesses a single item from a list using its position number and returns the data through a callback function. It's useful for accessing individual pieces of data from a sequence without retrieving the entire list.
## Syntax
```sqf
[_key, _index, _function, _call, _netId] call ramdb_db_fnc_listGet
```
## Parameters
| Parameter | Type | Description | Default |
|-------------|---------|------------------------------------------------------------|---------|
| `_key` | String | Name of the list | "" |
| `_index` | Number | Index position of the element to retrieve (0-based) | -1 |
| `_function` | String | Name of the function to receive the retrieved data | "" |
| `_call` | Boolean | Whether to call the function directly (true) or spawn (false) | false |
| `_netId` | String | (Optional) NetID of the player to receive the data | "" |
## Return Value
None. The retrieved data is passed to the specified callback function asynchronously.
## Examples
### Retrieve a specific event log entry:
```sqf
["events", 0, "ramdb_db_fnc_test"] call ramdb_db_fnc_listGet;
```
### Retrieve data with synchronous callback:
```sqf
["messages", 5, "ramdb_db_fnc_processMessage", true] call ramdb_db_fnc_listGet;
```
### Retrieve data and send it to a specific client:
```sqf
["notifications", 0, "ramdb_db_fnc_displayNotification", false, netId player] remoteExecCall ["ramdb_db_fnc_listGet", 2, false];
```
## Notes
- Retrieves a single element from a list by its index position
- The key, index, and function parameters are required and validated
- Index is zero-based (the first element is at index 0)
- If the index is out of bounds or the list doesn't exist, no data will be returned
- The data is retrieved asynchronously through the extension's callback system
- When a netId is provided, the data is sent to that specific client
- The `_call` parameter determines whether the function is called directly (synchronous) or spawned (asynchronous)
- For retrieving multiple elements, use `listLoad` instead
- All operations are logged for debugging purposes
## Related Functions
- `ramdb_db_fnc_listAdd`: Adds an element to 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_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)