configProperties: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
(21 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
|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. | |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. | ||
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. | Condition has to return [[true]] in order for the looked at property to be added to the resulting array. This command is a bit slower than [[configClasses]] but allows to access inherited entries. | ||
|s1= [[configProperties]] [config, condition, inherit] | |s1= [[configProperties]] [config, condition, inherit] | ||
Line 21: | Line 15: | ||
|p2= condition: [[String]] - (Optional, default "true") expression, which if returns [[true]], adds current property to result | |p2= condition: [[String]] - (Optional, default "true") expression, which if returns [[true]], adds current property to result | ||
{{Feature|important| | |||
* The condition code passed to [[configProperties]] should only be used for '''simple filter expressions''' and nothing more. | |||
* Since {{GVI|arma3|2.02}} the following conditions are optimised for performance: | |||
** {{hl|"true"}} (omitted condition) | |||
** {{hl|"isClass _x"}} | |||
** {{hl|"isClass _x && (...)"}} | |||
}} | |||
|p3= inherit: [[Boolean]] - (Optional, default [[true]]) include inherited properties | |p3= inherit: [[Boolean]] - (Optional, default [[true]]) include inherited properties | ||
|r1= [[Array]] - | |r1= [[Array]] - array of [[Config]]s | ||
|x1= <sqf>_configs = configProperties [configFile >> "CfgVehicles" >> "O_Truck_02_box_F"];</sqf> | |||
|x2= <sqf>_configs = configProperties [configFile >> "RscText", "true", true];</sqf> | |||
|x2= < | |||
|x3= Get all hitpoints of a truck:< | |x3= Get all hitpoints of a truck: | ||
_hitPointsCfgs = | <sqf> | ||
_hitPoints = []; | |||
" | _hitPointsCfgs = configProperties [ | ||
configFile >> "CfgVehicles" >> "O_Truck_02_box_F" >> "HitPoints", | |||
"true", | |||
true | |||
]; | ]; | ||
hint str _hitPointsCfgs; | |||
</sqf> | |||
|seealso= [[Config]] [[configFile]] | |seealso= [[Config]] [[configFile]] [[missionConfigFile]] [[configClasses]] [[configHierarchy]] | ||
}} | }} |
Latest revision as of 11:33, 8 April 2024
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. 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. This command is 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:
- Example 2:
- Example 3:
- Get all hitpoints of a truck:
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