ramdb/docs/list/listRemove.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.3 KiB

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

ramdb_db_fnc_listRemove

Description

Removes a specific element from a list stored at a specified key in the RAMDb database. This function allows for precise control over list content by targeting individual elements by their index, without affecting other elements in the list. This is particularly useful for removing outdated or no longer needed entries.

Syntax

[_key, _index] call ramdb_db_fnc_listRemove

Parameters

Parameter Type Description Default
_key String The key identifying the list from which to remove an element ""
_index Number The zero-based index of the element to remove from the list -1

Return Value

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

Examples

Remove the first element from an event log:

["eventLog", 0] call ramdb_db_fnc_listRemove;

Remove a specific player record:

["playerRecords", 5] call ramdb_db_fnc_listRemove;

Remove an element from a multiplayer environment:

["sharedData", 2] remoteExecCall ["ramdb_db_fnc_listRemove", 2, false];

Notes

  • This function removes only the element at the specified index. All other elements remain unchanged, though their indices may shift.
  • The index is zero-based, meaning the first element is at index 0, the second at index 1, and so on.
  • If an invalid index is provided (negative or exceeding the list length), the operation will not remove any elements.
  • The _key parameter must be a non-empty string, otherwise the function will exit without performing any action.
  • After removing an element, all subsequent elements shift down by one index to maintain a contiguous list.
  • The removal operation is permanent and cannot be undone except by re-adding the element.
  • All list operations are logged for debugging purposes.

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