ramdb/docs/hash/hashSetId.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

3.0 KiB

title, icon, excerpt
title icon excerpt
ArmaRAMDb - Hash Set ID mdi:file-text-outline Set the specified field to the respective value in the hash stored at key from RAMDb.

ramdb_db_fnc_hashSetId

Description

Sets the value of a specified field in a specific hash table identified by its key. This function allows storing various data types (arrays, strings, numbers, or booleans) in a targeted hash table, making it ideal for player-specific or entity-specific data storage. It provides a way to organize related data under a common identifier.

Syntax

[_key, _keyField, _data] call ramdb_db_fnc_hashSetId

Parameters

Parameter Type Description Default
_key String Identifier of the hash table ""
_keyField String Name of the field in the hash to set ""
_data Array, String, Number, or Boolean The value to store in the hash field []

Return Value

None. The operation runs synchronously to store the data.

Examples

Store a player's loadout under their UID:

[getPlayerUID player, "loadout", [getUnitLoadout player]] call ramdb_db_fnc_hashSetId;

Store vehicle data:

["vehicle_123", "status", [true, 100, 75, "active"]] call ramdb_db_fnc_hashSetId;

Store player data from a client:

[getPlayerUID player, "stats", [rank player, score player, name player]] remoteExecCall ["ramdb_db_fnc_hashSetId", 2, false];

Notes

  • Stores a single field-value pair in a specific hash table identified by _key
  • All three parameters (key, keyField, and data) are required and validated
  • If the hash table doesn't exist, it will be created automatically
  • If the field already exists in the hash table, its value will be overwritten
  • Supports various data types: arrays, strings, numbers, and booleans
  • Player UIDs are commonly used as keys to store player-specific data
  • Complex data structures should be serialized into arrays
  • The operation is executed immediately and synchronously
  • All operations are logged for debugging purposes
  • ramdb_db_fnc_hashSet: Sets a field value in the global hash table
  • ramdb_db_fnc_hashGetId: Retrieves a field value from a specific hash table
  • ramdb_db_fnc_hashGetAllId: Retrieves all fields from a specific hash table
  • ramdb_db_fnc_hashSetIdBulk: Sets multiple field-value pairs in multiple hash tables
  • ramdb_db_fnc_hashDeleteId: Removes a specific hash table

Hash Delete | Hash Delete Field | Hash Delete ID | Hash Get | Hash Get All | Hash Get All ID | Hash Get ID | Hash Set | Hash Set Bulk | Hash Set ID | Hash Set ID Bulk