configProperties: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|Game name=" to "|Game name= |gr1= Config |GROUP1= ")
(added info about optimised conditions)
Line 1: Line 1:
{{Command|Comments=
{{Command|Comments=
____________________________________________________________________________________________


| arma3 |Game name=
| arma3 |Game name=


|gr1= Config |GROUP1=
|gr1= Config |GROUP1=


|1.36|Game version=
|1.36|Game version=
____________________________________________________________________________________________


|  Returns an array of config entries which meet criteria in condition code. Command iterates through available classes and config properties for given config entry. If 3rd param is [[true]] the search also includes inherited properties. Current looked at config is stored in _x variable (similar to alternative [[count]] command implementation). Condition has to return [[true]] in order for the looked at property to be added to the resulting array. A bit slower than [[configClasses]] but allows to access inherited entires.
|  Returns an array of config entries which meet criteria in condition code. Command iterates through available classes and config properties for given config entry. If 3rd param is [[true]] the search also includes inherited properties. Current looked at config is stored in _x variable (similar to alternative [[count]] command implementation). Condition has to return [[true]] in order for the looked at property to be added to the resulting array. A bit slower than [[configClasses]] but allows to access inherited entires.
<br><br>{{warning| The condition code passed to [[configProperties]] should only be used for '''simple filter expressions''' and nothing more}}|DESCRIPTION=
<br><br>{{warning| The condition code passed to [[configProperties]] should only be used for '''simple filter expressions''' and nothing more}}
____________________________________________________________________________________________
{{Informative|With {{arma3}} 2.01.147002 the following conditions were optimised inside the engine:
* <tt>"true" </tt> (condition omitted)
* <tt>isClass _x</tt>
* <tt>isClass _x &&</tt> }}|DESCRIPTION=


| '''configProperties''' [config, condition, inherit] |SYNTAX=
| '''configProperties''' [config, condition, inherit] |SYNTAX=
Line 27: Line 25:


| [[Array]] - Array of [[Config]]s |RETURNVALUE=
| [[Array]] - Array of [[Config]]s |RETURNVALUE=
____________________________________________________________________________________________
 
 
|x1= <code>_configs = [[configProperties]] [<nowiki/>[[configFile]] >> "CfgVehicles" >> "O_Truck_02_box_F"];</code> |EXAMPLE1=
|x1= <code>_configs = [[configProperties]] [<nowiki/>[[configFile]] >> "CfgVehicles" >> "O_Truck_02_box_F"];</code> |EXAMPLE1=
    
    
Line 40: Line 37:
];
];
[[hint]] [[str]] _hitPointsCfgs;</code> |EXAMPLE3=
[[hint]] [[str]] _hitPointsCfgs;</code> |EXAMPLE3=
____________________________________________________________________________________________


| [[Config]], [[configFile]], [[missionConfigFile]], [[configClasses]], [[configHierarchy]] |SEEALSO=
| [[Config]], [[configFile]], [[missionConfigFile]], [[configClasses]], [[configHierarchy]] |SEEALSO=

Revision as of 15:58, 3 December 2020

Hover & click on the images for description

Description

Description:
Returns an array of config entries which meet criteria in condition code. Command iterates through available classes and config properties for given config entry. If 3rd param is true the search also includes inherited properties. Current looked at config is stored in _x variable (similar to alternative count command implementation). Condition has to return true in order for the looked at property to be added to the resulting array. A bit slower than configClasses but allows to access inherited entires.

The condition code passed to configProperties should only be used for simple filter expressions and nothing more
With Arma 3 2.01.147002 the following conditions were optimised inside the engine:
  • "true" (condition omitted)
  • isClass _x
  • isClass _x &&
Groups:
Config

Syntax

Syntax:
configProperties [config, condition, inherit]
Parameters:
[config, condition, inherit]: Array
config: Config - config entry to search
condition (Optional): String - expression, which if returns true, adds current property to result. Default: "true"
inherit (Optional): Boolean - include inherited properties. Default: true
Return Value:
Array - Array of Configs

Examples

Example 1:
_configs = configProperties [configFile >> "CfgVehicles" >> "O_Truck_02_box_F"];
Example 2:
_configs = configProperties [configFile >> "RscText", "true", true];
Example 3:
Get all hitpoints of a truck:_hitPoints = []; _hitPointsCfgs = configProperties [ configFile >> "CfgVehicles" >> "O_Truck_02_box_F" >> "HitPoints", "true", true ]; hint str _hitPointsCfgs;

Additional Information

See also:
ConfigconfigFilemissionConfigFileconfigClassesconfigHierarchy

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note