Arma 3 Scripting

Command in Variables

import

Also available as Markdown and JSON, or read the original wiki page.

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.

Note

For the config keyword, see import (Config).

Syntax

import variableName

Parameters:

Returns: Nothing

Examples

Example 1

private _myVar = 1;
call
{
    import "_myVar"; // similar to: private _myVar = _myVar;
};

Example 2

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

See also

privateAll · private · params

Community notes

Hypoxic125

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"