BIS fnc loadFunctions: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Generated by BIS_fnc_exportFunctionsToWiki)
 
m (Text replacement - "{{Feature|Informative|" to "{{Feature|informative|")
 
(36 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma3
____________________________________________________________________________________________
|version1= 1.00


| arma3 |= Game name
|gr1= Diagnostic


|1.00|= Game version
|descr= Compile scripts and save them into globally available functions. Defines [[_fnc_scriptName]] variable.
____________________________________________________________________________________________


| <pre>/*
|s1= [fileDirectory, prefix, nameVars, global] call [[BIS_fnc_loadFunctions]]


Description:
|p1= fileDirectory: [[String]] - script path
Compile scripts and save them into globally available functions.


Parameter(s):
|p2= prefix: [[String]] - variable prefix {{Feature|informative|{{hl|"BIS_fnc_"}} prefix is reserved and cannot be used.}}
0: STRING - script path
1: STRING - variable prefix
2: ARRAY - list of variables to be declared. Elements can be of following types:
variable: STRING - variable is (prefix + variable), loaded from (path + variable + ".sqf")
[variable:STRING,fileName:STRING] - variable is (prefix  variable), loaded from (path + fileName + ".sqf")
3: BOOL - true for global persistent execution on all clients


Returns:
|p3= nameVars: [[Array]] of [[String]]s '''or''' [[Array]] of [[Array]] - list of variables to be declared.
BOOL
* [[Array]] of [[String]]s to format [variable, variable, …] - final variable is {{hl|prefix + variable}}, loaded from {{hl|path + variable + ".sqf"}}
*/
* [[Array]] of [[Array]] to format [<nowiki/>[variable, fileName], [variable, fileName], …] - final variable is {{hl|prefix + variable}}, loaded from {{hl|path + fileName + ".sqf"}}


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|p4= global: [[Boolean]] - [[true]] for global persistent execution on all clients
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_loadFunctions]]; --> |= Syntax
|r1= [[Boolean]] - [[true]] when done


|p1= |= Parameter 1
|x1= <sqf>["scripts\myDir\", "MY_fnc_", ["script1", "script2"], true] call BIS_fnc_loadFunctions;</sqf>


| |= Return value
|x2= <sqf>["scripts\myDir\", "MY_fnc_", [["script1", "script1file"], ["script2", "script2file"]], false] call BIS_fnc_loadFunctions;</sqf>
____________________________________________________________________________________________
 
|x1= <code></code> |=
____________________________________________________________________________________________
 
| |= See also


|seealso= [[compile]] [[compileFinal]] [[preprocessFileLineNumbers]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Variables|{{uc:loadFunctions}}]]
[[Category:Functions|{{uc:loadFunctions}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:loadFunctions}}]]

Latest revision as of 00:24, 2 February 2024

Hover & click on the images for description

Description

Description:
Compile scripts and save them into globally available functions. Defines _fnc_scriptName variable.
Execution:
call
Groups:
Diagnostic

Syntax

Syntax:
[fileDirectory, prefix, nameVars, global] call BIS_fnc_loadFunctions
Parameters:
fileDirectory: String - script path
prefix: String - variable prefix
"BIS_fnc_" prefix is reserved and cannot be used.
nameVars: Array of Strings or Array of Array - list of variables to be declared.
  • Array of Strings to format [variable, variable, …] - final variable is prefix + variable, loaded from path + variable + ".sqf"
  • Array of Array to format [[variable, fileName], [variable, fileName], …] - final variable is prefix + variable, loaded from path + fileName + ".sqf"
global: Boolean - true for global persistent execution on all clients
Return Value:
Boolean - true when done

Examples

Example 1:
["scripts\myDir\", "MY_fnc_", ["script1", "script2"], true] call BIS_fnc_loadFunctions;
Example 2:
["scripts\myDir\", "MY_fnc_", [["script1", "script1file"], ["script2", "script2file"]], false] call BIS_fnc_loadFunctions;

Additional Information

See also:
compile compileFinal preprocessFileLineNumbers

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note