import: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Leopard20 moved page import to import (Config): Name conflict with import command)
Tag: New redirect
 
("import" scripting command)
Tag: Removed redirect
Line 1: Line 1:
#REDIRECT [[import (Config)]]
{{RV|type=command
 
|game1= arma3
|version1= 2.16
 
|arg= local
|eff= global
 
|gr1= Object Manipulation
 
|descr= Imports one or multiple local variables from the parent scope, and defines them as [[private]] variables in the current scope. It can bypass [[privateAll]].
 
|s1= [[import]] variableName
 
|p1= variableName: [[String]] - variable to import
 
|r1= [[Nothing]]
 
|s2= [[import]] variableNames
 
|p21= variableName: [[Array]] of [[String]]s - variables to import
 
|r2= [[Nothing]]
 
|x1= <sqf>
_myVar = 1;
call
{
  import "_myVar"; // similar to: private _myVar = _myVar;
}
</sqf>
 
|x2= <sqf>
_a = 1;
_b = 2;
call
{
  import ["_a", "_b"]; // similar to: [_a, _b] params ["_a", "_b"];
}
</sqf>
 
|seealso= [[privateAll]] [[private]] [[params]]
}}

Revision as of 18:27, 30 October 2023

Hover & click on the images for description

Description

Description:
Imports one or multiple local variables from the parent scope, and defines them as private variables in the current scope. It can bypass privateAll.
Groups:
Object Manipulation

Syntax

Syntax:
import variableName
Parameters:
variableName: String - variable to import
Return Value:
Nothing

Alternative Syntax

Syntax:
import variableNames
Parameters:
variableName: Array of Strings - variables to import
Return Value:
Nothing

Examples

Example 1:
_myVar = 1; call { import "_myVar"; // similar to: private _myVar = _myVar; }
Example 2:
_a = 1; _b = 2; call { import ["_a", "_b"]; // similar to: [_a, _b] params ["_a", "_b"]; }

Additional Information

See also:
privateAll private params

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