When making local functions, the imported variable does not have to exist until the function is called.
// Local function
private _stringifyNum = {
import "_num";
str _num;
};
private _num = 5;
call _stringifyNum;
// Returns "5"
Imports one or multiple local variables from the parent scope, and defines them as private variables in the current scope. It can bypass privateAll.
Note
For the config keyword, see import (Config).
import variableName
Parameters:
Returns: Nothing
private _myVar = 1;
call
{
import "_myVar"; // similar to: private _myVar = _myVar;
};
private _a = 1;
private _b = 2;
call
{
import ["_a", "_b"]; // similar to: [_a, _b] params ["_a", "_b"];
};
privateAll · private · params
When making local functions, the imported variable does not have to exist until the function is called.
// Local function
private _stringifyNum = {
import "_num";
str _num;
};
private _num = 5;
call _stringifyNum;
// Returns "5"