Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add default value for CBA_fnc_serializeNamespace #1044

Merged
merged 2 commits into from
Jan 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions addons/hashes/fnc_serializeNamespace.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Description:

Parameters:
_namespace - a namespace <LOCATION, OBJECT>
_defaultValue - Default value. Used when key doesn't exist. A key is also removed from the hash if the value is set to this default [Any, defaults to nil]

Returns:
_hash - a hash <ARRAY>
Expand All @@ -22,9 +23,9 @@ Author:
---------------------------------------------------------------------------- */
SCRIPT(serializeNamespace);

params [["_namespace", locationNull, [locationNull, objNull]]];
params [["_namespace", locationNull, [locationNull, objNull]], "_defaultValue"];

private _hash = [] call CBA_fnc_hashCreate;
private _hash = [[], RETNIL(_defaultValue)] call CBA_fnc_hashCreate;

{
[_hash, _x, _namespace getVariable _x] call CBA_fnc_hashSet;
Expand Down