{"name":"import","title":"import","type":"command","url":"https://community.bistudio.com/wiki/import","revid":369760,"updated":"2024-10-08T15:08:56Z","groups":["Variables"],"status":"ok","games":{"arma3":"2.18"},"since":"arma3 2.18","arma3_since":"2.18","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.\n\n> [!NOTE]\n> For the config keyword, see import (Config).","syntaxes":[{"syntax":"import variableName","params":[{"name":"variableName","type":"String or Array of Strings","description":"variable(s) to import","type_expr":"String | Array<String>"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"unary","right":{"text":"variableName"}}],"examples":[{"text":"```sqf\nprivate _myVar = 1;\ncall\n{\n    import \"_myVar\"; // similar to: private _myVar = _myVar;\n};\n```","code":["private _myVar = 1;\ncall\n{\n\timport \"_myVar\"; // similar to: private _myVar = _myVar;\n};"]},{"text":"```sqf\nprivate _a = 1;\nprivate _b = 2;\ncall\n{\n    import [\"_a\", \"_b\"]; // similar to: [_a, _b] params [\"_a\", \"_b\"];\n};\n```","code":["private _a = 1;\nprivate _b = 2;\ncall\n{\n\timport [\"_a\", \"_b\"]; // similar to: [_a, _b] params [\"_a\", \"_b\"];\n};"]}],"see_also":["privateAll","private","params"],"notes":[{"user":"Hypoxic125","date":"2024-03-03T18:31:25Z","text":"When making local functions, the imported variable does not have to exist until the function is called.\n\n```sqf\n// Local function\nprivate _stringifyNum = {\n    import \"_num\";\n    str _num;\n};\n\nprivate _num = 5;\ncall _stringifyNum;\n// Returns \"5\"\n```"}]}