dragonfly/docs/list/listAdd.md
Jacob Schmidt c8d81ba3bb
All checks were successful
Build / Build (push) Successful in 39s
docs: Update README.md with detailed documentation
This commit significantly enhances the `README.md` file, providing comprehensive documentation for the ArmaDragonflyClient.

Key changes:

*   **Detailed Function Categories:** Categorized functions for better organization (Core, Basic Data Operations, Hash Operations, List Operations).
*   **Usage Examples:** Added clear and concise usage examples for basic operations, hash operations (context and ID-specific), and list operations.
*   **Function Documentation Structure:** Outlined the structure for individual function documentation.
*   **License Information:** Updated the license information.
2025-03-30 17:15:35 -05:00

2.5 KiB

title, icon, excerpt
title icon excerpt
ArmaDragonflyClient - List Add mdi:file-text-outline 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

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

List Add | List Get | List Load | List Remove | List Set