# ArmaRAMDb: listGet

Loading...
Searching...
No Matches
listGet

## autotoc_md372

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

[_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:

["events", 0, "ramdb_db_fnc_test"] call ramdb_db_fnc_listGet;

### Retrieve data with synchronous callback:

["messages", 5, "ramdb_db_fnc_processMessage", true] call ramdb_db_fnc_listGet;

### Retrieve data and send it to a specific client:

["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 | List Delete | List Get | List Load | List Remove | List Set