{"name":"import","operator":null,"title":"import","type":"command","url":"https://community.bistudio.com/wiki/import","revid":369760,"updated":"2024-10-08T15:08:56Z","groups":["Variables"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"2.18"}],"since":{"game":"arma3","name":"Arma 3","version":"2.18"},"arma3_since":"2.18","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"variableName","type":"String or Array of Strings","optional":false,"default":null,"description":"variable(s) to import","types":["String","Array"],"since":null,"text":"variableName: String or Array of Strings - variable(s) to import"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"unary","operator":null,"left":null,"right":{"text":"variableName","types":["String","Array"]}}],"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};"]}],"multiplayer":null,"problems":null,"aliases":[],"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```"}],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Variables","Introduced with Arma 3 version 2.18","Scripting Commands"]}