{"name":"vehicleVarName","title":"vehicleVarName","type":"command","url":"https://community.bistudio.com/wiki/vehicleVarName","revid":352868,"updated":"2024-02-28T19:33:35Z","groups":["Object Manipulation"],"status":"ok","games":{"arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma1 1.00","arma3_since":"0.50","locality":{"argument":"global"},"description":"Returns the variable name that contains a primary editor reference to this object. This is the variable given in the *Insert Unit dialog / name field* in the editor. It can be changed using setVehicleVarName.\n\n> [!NOTE]\n> Respawned unit will have the same vehicleVarName as the corpse left behind, however actual missionNamespace variable of the same name will only contain respawned unit.","syntaxes":[{"syntax":"vehicleVarName object","params":[{"name":"object","type":"Object","type_expr":"Object"}],"returns":{"type":"String","type_expr":"String","description":"variable name, if none was set, an empty string is returned"},"form":"unary","right":{"text":"object"}}],"examples":[{"code":["hint vehicleVarName player;"]}],"see_also":["setVehicleVarName","BIS_fnc_objectVar"],"notes":[{"user":"Killzone_Kid","date":"2015-04-19T08:45:00Z","text":"To get variable names referencing an object in mission namespace:\n\n```sqf\nKK_fnc_objectVarNames = {\n    private \"_names\";\n    _names = [];\n    {\n        if (missionNamespace getVariable _x isEqualTo _this) then {\n            _names pushBack _x;\n        };\n    } forEach allVariables missionNamespace;\n    _names\n};\n\n// Example\nmyGroup = group player;\naGroup = group player;\nhint str (group player call KK_fnc_objectVarNames); // [\"agroup\", \"mygroup\"]\n```"}]}