{"name":"getText","title":"getText","type":"command","url":"https://community.bistudio.com/wiki/getText","revid":341205,"updated":"2023-05-13T22:31:13Z","groups":["Config"],"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","description":"Extracts localized text from config entry, if entry is subject to localization, otherwise returns text value.\nTo obtain the translation key itself, see getTextRaw.","syntaxes":[{"syntax":"getText config","params":[{"name":"config","type":"Config","type_expr":"Config"}],"returns":{"type":"String","type_expr":"String","description":"text value"},"form":"unary","right":{"text":"config"}}],"examples":[{"code":["_text = getText (configFile >> \"CfgVehicles\" >> \"Thing\" >> \"icon\"); // \"Get in %1 as Driver\""]}],"see_also":["configFile","a / b","configName","count","getArray","getNumber","inheritsFrom","isArray","isClass","isNumber","isText","select","getTextRaw"],"notes":[{"user":"ffur2007slx2_5","date":"2014-03-28T07:52:00Z","text":"(Arma 3 1.14) It's recommended to use BIS_fnc_getCfgData or BIS_fnc_returnConfigEntry to get variable cfg data rather than conditioning via isNumber, isText, isArray, getNumber, getText and getArray combination.\nTraditional workaround:\n\n```sqf\n_cfg = configFile >> \"CfgVehicles\" >> _SomeAddonClassName >> \"DestructionEffects\" >> \"Smoke1\" >> \"type\";\nswitch ( true ) do\n{\n    case (isNumber _cfg): {getNumber _cfg};\n    case (isText _cfg): {getText _cfg};\n    case (isArray _cfg): {getArray _cfg;};\n    default { nil };\n};\n```\n\n**Recommended workaround:**\n\n```sqf\n(configFile >> \"CfgVehicles\" >> _SomeAddonClassName >> \"DestructionEffects\" >> \"Smoke1\" >> \"type\") call BIS_fnc_getCfgData;\n```\n\nTo return default value once entry was not found, we can use BIS_fnc_returnConfigEntry instead of BIS_fnc_getCfgData. e.g.\n\n```sqf\n[(configFile >> \"CannonFire\" >> \"LightExp\"),\"lifeTime\",0] call BIS_fnc_returnConfigEntry;//0.5\n```\n\nTo compose collected String into Array, use BIS_fnc_getCfgDataArray instead. E.g.\n\n```sqf\n(configFile >> \"CfgVehicles\" >> _SomeAddonClassName >> \"DestructionEffects\" >> \"Smoke1\" >> \"type\") call BIS_fnc_getCfgDataArray;\n```"}]}