{"name":"BIS_fnc_spawn","title":"BIS fnc spawn","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_spawn","revid":327596,"updated":"2022-07-13T09:48:17Z","groups":["Program Flow"],"status":"ok","games":{"arma3":"0.56"},"since":"arma3 0.56","arma3_since":"0.56","exec":"spawn","description":"Execute given code with or without parameter.\n\n> [!NOTE]\n> **Arma 3:** Since Arma 3 v1.50, use remoteExec/remoteExecCall instead.","syntaxes":[{"syntax":"[params, code] spawn BIS_fnc_spawn","params":[{"name":"params","type":"Anything","description":"function arguments","type_expr":"Anything"},{"name":"code","type":"Code","description":"function code","type_expr":"Code"}],"returns":{"type":"Nothing","type_expr":"Nothing"}},{"syntax":"code spawn BIS_fnc_spawn","params":[{"name":"code","type":"Code","type_expr":"Code"}],"returns":{"type":"Nothing","type_expr":"Nothing"}}],"examples":[{"text":"Show a message for the current player:\n\n```sqf\n[[\"Hello\"],  { hint (_this select 0) }] spawn BIS_fnc_spawn;\n```","code":["[[\"Hello\"],  { hint (_this select 0) }] spawn BIS_fnc_spawn;"]},{"text":"Show a message to all connected players:\n\n```sqf\n[[[\"Hello\"], { hint (_this select 0) }], \"BIS_fnc_spawn\", true, false, false] call BIS_fnc_MP; // obsolete, use remoteExec\n\n[\"Hello\", { hint (_this select 0) }] remoteExec [\"BIS_fnc_spawn\"];    // since the introduction of remoteExec\n[\"Hello\", { hint (_this select 0) }] remoteExec [\"spawn\"];            // BIS_fnc_spawn is obsolete\n[\"Hello\"] remoteExec [\"hint\"];                                        // best solution here\n```","code":["[[[\"Hello\"], { hint (_this select 0) }], \"BIS_fnc_spawn\", true, false, false] call BIS_fnc_MP; // obsolete, use remoteExec\n\n[\"Hello\", { hint (_this select 0) }] remoteExec [\"BIS_fnc_spawn\"];\t// since the introduction of remoteExec\n[\"Hello\", { hint (_this select 0) }] remoteExec [\"spawn\"];\t\t\t// BIS_fnc_spawn is obsolete\n[\"Hello\"] remoteExec [\"hint\"];\t\t\t\t\t\t\t\t\t\t// best solution here"]},{"code":["{ hint \"Hello\" } spawn BIS_fnc_spawn;"]}],"see_also":["remoteExec","remoteExecCall","BIS_fnc_execFSM","BIS_fnc_execRemote","BIS_fnc_execVM","BIS_fnc_call"]}