dragonfly/docs/core/addTask.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

3.0 KiB

title, icon, excerpt
title icon excerpt
ArmaDragonflyClient - Add Task mdi:file-text-outline Add task to queue.

dragonfly_db_fnc_addTask

Description

Adds a task to the database operation queue. This function is used to schedule database operations that can be processed sequentially, providing a way to manage multiple database requests in an organized manner.

Syntax

[_taskType, _key, _keyField, _index, _value, _function, _call, _netId] call dragonfly_db_fnc_addTask

Parameters

Parameter Type Description Default
_taskType String Type of operation to perform (e.g., "hgetall") ""
_key String Name of the stored key ""
_keyField String Field name for hash operations ""
_index Number Index for list operations -1
_value Array, String, Number, or Boolean Value to store (for set operations) []
_function String Name of function to call with the result ""
_call Boolean Whether to call the function directly (true) or spawn (false) false
_netId String NetID of the target to receive the result ""

Return Value

None. The task is added to the queue and processed asynchronously.

Examples

Add a hash table retrieval task:

["hgetall", "", "", -1, [], "dragonfly_db_fnc_test"] call dragonfly_db_fnc_addTask;

Add a player-specific task that returns data to a specific client:

["hgetallid", getPlayerUID player, "", -1, [], "dragonfly_db_fnc_test", false, netId player] remoteExecCall ["dragonfly_db_fnc_addTask", 2, false];

Add a list operation task:

["listadd", "playerMessages", "", -1, ["New message content"], ""] call dragonfly_db_fnc_addTask;

Notes

  • Tasks are processed in the order they are added to the queue
  • If the queue is not currently being processed, this function will start the processing
  • The task type determines which database operation will be performed
  • This function is particularly useful for scheduling multiple related operations
  • All operations performed through the task queue are logged for debugging
  • dragonfly_db_fnc_processQueue: Processes the pending tasks in the queue
  • dragonfly_db_fnc_handler: Handles the results of completed database operations
  • dragonfly_db_fnc_scheduler: Manages callback responses from the database

Add Task | Handler | Init | Print Addon Name | Process Queue | Scheduler | Test