dragonfly/docs/list/listSet.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.7 KiB

title, icon, excerpt
title icon excerpt
ArmaDragonflyClient - List Set mdi:file-text-outline Set an element in a list stored at a key in DragonflyClient.

dragonfly_db_fnc_listSet

Description

Updates or sets the value of a specific element at a given index in a list stored at a specified key in the DragonflyClient database. This function allows for precise modification of list contents by targeting individual elements without affecting other elements in the list. It is particularly useful for updating record information, modifying configuration data, or correcting entries.

Syntax

[_key, _index, _data] call dragonfly_db_fnc_listSet

Parameters

Parameter Type Description Default
_key String The key identifying the list in which to set an element ""
_index Number The zero-based index of the element to set in the list -1
_data Array/String/Number/Boolean The value to set at the specified index []

Return Value

None. The operation runs synchronously to update the element immediately.

Examples

Update an event log entry:

["eventLog", 0, ["Updated event information"]] call dragonfly_db_fnc_listSet;

Modify player statistics:

["playerStats", 3, [name player, score player, alive player]] call dragonfly_db_fnc_listSet;

Update configuration in multiplayer:

["missionConfig", 1, ["difficulty", "veteran"]] remoteExecCall ["dragonfly_db_fnc_listSet", 2, false];

Notes

  • This function updates only the element at the specified index. All other elements remain unchanged.
  • The index is zero-based, meaning the first element is at index 0, the second at index 1, and so on.
  • If the specified index does not exist in the list, the operation may fail or have no effect.
  • Both the _key parameter and _data parameter must be valid (non-empty string for key, non-nil for data), otherwise the function will exit without performing any action.
  • The function supports various data types, including arrays, strings, numbers, and booleans.
  • The update operation is permanent and will overwrite any previous value at the specified index.
  • All list operations are logged for debugging purposes.
  • dragonfly_db_fnc_listAdd: Adds an element to a list
  • 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_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