Skip to content

Commit 9c8a9d4

Browse files
committed
Create fnc_getCodeFromString.sqf
1 parent f1147b6 commit 9c8a9d4

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include "script_component.hpp"
2+
/* ----------------------------------------------------------------------------
3+
Function: CBA_fnc_getCfgDataRandom
4+
5+
Description:
6+
Converts a String into Code - Also checks for existing Functions with that name.
7+
8+
Parameters:
9+
_str - Code as String <STRING>
10+
11+
Returns:
12+
Code as Code <CODE>
13+
14+
Examples:
15+
(begin example)
16+
getText (_cfg >> "statement") call cvo_common_fnc_convertStringCode
17+
(end)
18+
19+
Author:
20+
OverlordZorn
21+
---------------------------------------------------------------------------- */
22+
23+
24+
params [ ["_stringCode", "", [""] ] ];
25+
26+
switch (true) do {
27+
case (_stringCode isEqualTo ""): { {} };
28+
case (!(missionNamespace isNil _stringCode)): { missionNamespace getVariable _stringCode };
29+
case (!(uiNamespace isNil _stringCode)): { uiNamespace getVariable _stringCode };
30+
default { compile _stringCode };
31+
}

0 commit comments

Comments
 (0)