--- title: ArmaDragonflyClient - List Add icon: mdi:file-text-outline excerpt: Add element to list stored at key from DragonflyClient. --- # dragonfly_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 ```sqf [_key, _data] call dragonfly_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: ```sqf ["events", ["Server state saved to DB " + systemTimeUTC]] call dragonfly_db_fnc_listAdd; ``` ### Add a player message: ```sqf ["messages", [name player + ": " + _messageText]] call dragonfly_db_fnc_listAdd; ``` ### Add data from a client: ```sqf ["playerActions", [getPlayerUID player, name player, "logged in"]] remoteExecCall ["dragonfly_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 - `dragonfly_db_fnc_listGet`: Retrieves a specific element from 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)