# ArmaRAMDb: listAdd

Loading...
Searching...
No Matches
listAdd

## autotoc_md347

title: ArmaRAMDb - List Add icon: mdi:file-text-outline

## excerpt: Add element to list stored at key from RAMDb.

# ramdb_db_fnc_listAdd

## Description

Adds an element to a list stored in the database under the specified key. This function appends values to an existing list or creates a new list if it doesn't exist. It's particularly useful for logging, event tracking, or maintaining collections of data that grow over time.

## Syntax

[_key, _data] call ramdb_db_fnc_listAdd

## Parameters

Parameter | Type | Description | Default
--- | --- | --- | ---
`_key` | String | Name of the list to add the element to | ""
`_data` | Array, String, Number, or Boolean | The value to insert into the list | []

## Return Value

None. The operation runs synchronously to add the element to the list.

## Examples

### Add an event log entry:

["events", ["Server state saved to DB " + systemTimeUTC]] call ramdb_db_fnc_listAdd;

### Add a player message:

["messages", [name player + ": " + _messageText]] call ramdb_db_fnc_listAdd;

### Add data from a client:

["playerActions", [getPlayerUID player, name player, "logged in"]] remoteExecCall ["ramdb_db_fnc_listAdd", 2, false];

## Notes

- Elements are added to the end of the list in the order they are inserted
- If the list doesn't exist, it will be created automatically
- Both the key and data parameters are required and validated
- Lists can store various data types (arrays, strings, numbers, or booleans)
- Useful for maintaining a history of events, logs, or sequential data
- The operation is executed immediately and synchronously
- New elements are always added to the end of the list
- All operations are logged for debugging purposes

## Related Functions

- `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_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