{"name":"getText","operator":null,"title":"getText","type":"command","url":"https://community.bistudio.com/wiki/getText","revid":341205,"updated":"2023-05-13T22:31:13Z","groups":["Config"],"status":"ok","replaced_by":[],"games":[{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma1","name":"Armed Assault","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"config","type":"Config","optional":false,"default":null,"description":null,"types":["Config"],"since":null,"text":"config: Config"}],"returns":{"type":"String","types":["String"],"description":"text value","text":"String - text value"},"form":"unary","operator":null,"left":null,"right":{"text":"config","types":["Config"]}}],"examples":[{"text":"```sqf\n_text = getText (configFile >> \"CfgVehicles\" >> \"Thing\" >> \"icon\"); // \"Get in %1 as Driver\"\n```","code":["_text = getText (configFile >> \"CfgVehicles\" >> \"Thing\" >> \"icon\"); // \"Get in %1 as Driver\""]}],"multiplayer":null,"problems":null,"aliases":[],"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.\n\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```"}],"categories":["ArmA: Armed Assault: New Scripting Commands","ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Config","Introduced with Armed Assault version 1.00","Scripting Commands","Take On Helicopters: Scripting Commands"]}