List Add
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 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:
["events", ["Server state saved to DB " + systemTimeUTC]] call dragonfly_db_fnc_listAdd;
Add a player message:
["messages", [name player + ": " + _messageText]] call dragonfly_db_fnc_listAdd;
Add data from a client:
["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
Links
List Add | List Get | List Load | List Remove | List Set