ramdb/docs/list/listSet.md
Jacob Schmidt 5b9f3402b6
All checks were successful
Build / Build (push) Successful in 30s
docs: add comprehensive documentation and usage examples for ramdb
2025-03-22 16:31:59 -05:00

2.5 KiB

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

ramdb_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 RAMDb 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 ramdb_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 ramdb_db_fnc_listSet;

Modify player statistics:

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

Update configuration in multiplayer:

["missionConfig", 1, ["difficulty", "veteran"]] remoteExecCall ["ramdb_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.

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