
All checks were successful
Build / Build (push) Successful in 39s
This commit significantly enhances the `README.md` file, providing comprehensive documentation for the ArmaDragonflyClient. Key changes: * **Detailed Function Categories:** Categorized functions for better organization (Core, Basic Data Operations, Hash Operations, List Operations). * **Usage Examples:** Added clear and concise usage examples for basic operations, hash operations (context and ID-specific), and list operations. * **Function Documentation Structure:** Outlined the structure for individual function documentation. * **License Information:** Updated the license information.
69 lines
3.0 KiB
Markdown
69 lines
3.0 KiB
Markdown
---
|
|
title: ArmaDragonflyClient - List Get
|
|
icon: mdi:file-text-outline
|
|
excerpt: Get element of list stored at key from DragonflyClient.
|
|
---
|
|
|
|
# dragonfly_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 dragonfly_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, "dragonfly_db_fnc_test"] call dragonfly_db_fnc_listGet;
|
|
```
|
|
|
|
### Retrieve data with synchronous callback:
|
|
```sqf
|
|
["messages", 5, "dragonfly_db_fnc_processMessage", true] call dragonfly_db_fnc_listGet;
|
|
```
|
|
|
|
### Retrieve data and send it to a specific client:
|
|
```sqf
|
|
["notifications", 0, "dragonfly_db_fnc_displayNotification", false, netId player] remoteExecCall ["dragonfly_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
|
|
- `dragonfly_db_fnc_listAdd`: Adds an element to 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_listRemove`: Removes a specific element from a list
|
|
- `dragonfly_db_fnc_scheduler`: Processes the callback from the database extension
|
|
|
|
## Links
|
|
|
|
[List Add](listAdd.md) |
|
|
[List Get](listGet.md) |
|
|
[List Load](listLoad.md) |
|
|
[List Remove](listRemove.md) |
|
|
[List Set](listSet.md) |