List Get
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
[_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 | nil |
Return Value
None. The retrieved data is passed to the specified callback function asynchronously.
Examples
Retrieve a specific event log entry:
["events", 0, "dragonfly_db_fnc_test"] call dragonfly_db_fnc_listGet;
Retrieve data with synchronous callback:
["messages", 5, "dragonfly_db_fnc_processMessage", true] call dragonfly_db_fnc_listGet;
Retrieve data and send it to a specific client:
["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
Links
List Add | List Get | List Load | List Remove | List Set