configProperties: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\| *(arg|eff|mp|serverExec|gr[0-9]) *= *(.*) * *\|([^=]{12})" to "|$1=$2 |descr=$3") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 1: | Line 1: | ||
{{RV|type=command | {{RV|type=command | ||
| arma3 | |game1= arma3 | ||
|version1= 1.36 | |||
|gr1= Config | |gr1= Config | ||
|descr= | |descr= 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 entries. | |||
{{Feature|Warning| The condition code passed to [[configProperties]] should only be used for '''simple filter expressions''' and nothing more}} | {{Feature|Warning|The condition code passed to [[configProperties]] should only be used for '''simple filter expressions''' and nothing more.}} | ||
{{Feature|Informative|With {{arma3}} 2.01.147002 the following conditions were optimised inside the engine: | {{Feature|Informative|With {{arma3}} 2.01.147002 the following conditions were optimised inside the engine: | ||
* <tt>"true" </tt> (condition omitted) | * <tt>"true"</tt> (condition omitted) | ||
* <tt>isClass _x</tt> | * <tt>isClass _x</tt> | ||
* <tt>isClass _x &&</tt> }} | * <tt>isClass _x &&</tt> | ||
}} | |||
| | |s1= [[configProperties]] [config, condition, inherit] | ||
| | |p1= config: [[Config]] - config entry to search | ||
| | |p2= condition: [[String]] - (Optional, default "true") expression, which if returns [[true]], adds current property to result | ||
| | |p3= inherit: [[Boolean]] - (Optional, default [[true]]) include inherited properties | ||
|r1=[[Array]] - Array of [[Config]]s | |r1= [[Array]] - Array of [[Config]]s | ||
|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= |
Revision as of 23:09, 13 June 2021
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 entries.
- Groups:
- Config
Syntax
- Syntax:
- configProperties [config, condition, inherit]
- Parameters:
- config: Config - config entry to search
- condition: String - (Optional, default "true") expression, which if returns true, adds current property to result
- inherit: Boolean - (Optional, default true) include inherited properties
- 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
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