server/addons/db/functions/fnc_getFromStore.sqf
Jacob Schmidt bec0adcdbf feat: Update build environment and add XEH PREP
This commit includes the following changes:

-   Updates the build environment in the GitHub Actions workflow to use `ubuntu-latest` instead of `ubuntu-22.04`.
-   Adds `playerGroup2Server` to the XEH_PREP.hpp file.
-   Updates the picture path in CfgMods.hpp to include the file extension.
2025-03-28 09:46:08 -05:00

39 lines
956 B
Plaintext

#include "..\script_component.hpp"
/*
* Function: forge_server_db_fnc_getFromStore
* Author: J. Schmidt
*
* Description:
* Retrieves data from a store
*
* Arguments:
* 0: _name - Store name <STRING>
* 1: _key - Key to retrieve (Optional, get entire store if empty) <STRING>
* 2: _default - Default value if key not found <ANY>
* 3: _namespace - Namespace to use (Optional, default: missionNamespace) <NAMESPACE>
*
* Return Value:
* Retrieved data or default value
*/
params [
["_name", "", [""]],
["_key", "", [""]],
["_default", nil],
["_namespace", missionNamespace, [missionNamespace]]
];
if (_name isEqualTo "") exitWith {
ERROR_MSG_1("Invalid store name: %1",_name);
_default
};
private _stores = _namespace getVariable [QGVAR(stores), createHashMap];
private _store = _stores getOrDefault [_name, createHashMap];
if (_key isEqualTo "") then {
_store
} else {
_store getOrDefault [_key, _default]
}