ramdb/docs/basic/set.md
Jacob Schmidt 8c0e8144e5 docs: Update documentation links and function references
This commit updates the documentation to reflect the current function names and link structure. Specifically, it addresses the following:

*   Corrected internal links within the documentation to point to the correct markdown files (e.g., `hashDelete.md` instead of `hashDelete`).
*   Updated related function references to reflect the current function names and include missing functions.
*   Removed outdated function references.
*   Added `ramdb_db_fnc_scheduler` to related functions where appropriate.
*   Updated the links section to use the correct markdown file names.
2025-03-22 16:53:30 -05:00

58 lines
1.9 KiB
Markdown

---
title: ArmaRAMDb - Set Key
icon: mdi:file-text-outline
excerpt: Set the value of stored key from RAMDb.
---
# ramdb_db_fnc_set
## Description
Stores a value in the database with the specified key. This function allows saving various data types (arrays, strings, numbers, or booleans) that can be retrieved later using the key.
## Syntax
```sqf
[_key, _data] call ramdb_db_fnc_set
```
## Parameters
| Parameter | Type | Description | Default |
|-----------|----------------------------------|----------------------------------------------|---------|
| `_key` | String | Name of the key to store the data under | "" |
| `_data` | Array, String, Number, or Boolean| The value to store in the database | [] |
## Return Value
None. The operation runs asynchronously.
## Examples
### Store a simple array:
```sqf
["playerInventory", ["item1", "item2", "item3"]] call ramdb_db_fnc_set;
```
### Store player data under their UID:
```sqf
[getPlayerUID player, [name player, getPos player, getAllGear player]] call ramdb_db_fnc_set;
```
### Call the set function remotely from a client:
```sqf
["serverSetting", [true, 30, "normal"]] remoteExecCall ["ramdb_db_fnc_set", 2, false];
```
## Notes
- The function validates both the key and data before attempting to store
- If the key already exists, its value will be overwritten
- Complex data structures should be serialized into arrays
- There are no size limits for data, but extremely large values might impact performance
- For structured data, consider using hash tables instead of key-value pairs
## Related Functions
- `ramdb_db_fnc_get`: Retrieves a value by key
- `ramdb_db_fnc_delete`: Removes a value by key
- `ramdb_db_fnc_scheduler`: Processes the callback response
## Links
[Delete Key](delete.md) |
[Get Key](get.md) |
[Set Key](set.md)