Skip to content

Commit

Permalink
add CBA_fnc_allNamespaces (#608)
Browse files Browse the repository at this point in the history
* add CBA_fnc_allNamespaces

* clarify types in function header
  • Loading branch information
commy2 authored Mar 2, 2017
1 parent 4864914 commit a4a83c4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions addons/common/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class CfgFunctions {
PATHTO_FNC(removePlayerAction);
PATHTO_FNC(createNamespace);
PATHTO_FNC(deleteNamespace);
PATHTO_FNC(allNamespaces);
PATHTO_FNC(directCall);
PATHTO_FNC(objectRandom);
PATHTO_FNC(execNextFrame);
Expand Down
24 changes: 24 additions & 0 deletions addons/common/fnc_allNamespaces.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* ----------------------------------------------------------------------------
Function: CBA_fnc_allNamespaces
Description:
Reports namespaces created with CBA_fnc_createNamespace.
Parameters:
None
Returns:
_namespaces - all custom namespaces <ARRAY of LOCATION, OBJECT>
Examples:
(begin example)
_namespaces = call CBA_fnc_allNamespaces;
(end)
Author:
commy2
---------------------------------------------------------------------------- */
#include "script_component.hpp"
SCRIPT(allNamespaces);

nearestLocations [DUMMY_POSITION, ["CBA_NamespaceDummy"], 1] + nearestObjects [DUMMY_POSITION, ["CBA_NamespaceDummy"], 1]
4 changes: 1 addition & 3 deletions addons/common/fnc_createNamespace.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Function: CBA_fnc_createNamespace
Description:
Creates a namespace. Used to store and read variables via setVariable and getVariable.
The Namespace is destroyed after the mission ends. getVariable ARRAY is not supported.
The Namespace is destroyed after the mission ends.
Parameters:
_isGlobal - create a global namespace (optional, default: false) <BOOLEAN>
Expand All @@ -26,8 +26,6 @@ Author:
#include "script_component.hpp"
SCRIPT(createNamespace);

#define DUMMY_POSITION [-1000, -1000, 0]

params [["_isGlobal", false]];

if (_isGlobal isEqualTo true) then {
Expand Down
2 changes: 2 additions & 0 deletions addons/common/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
#endif

#include "\x\cba\addons\main\script_macros.hpp"

#define DUMMY_POSITION [-1000, -1000, 0]

0 comments on commit a4a83c4

Please sign in to comment.