configProperties: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Bot: Reverted to revision 99427 by killzone_kid on 2017-04-15T13:22:53Z)
m (template:command argument fix)
Line 9: Line 9:


|  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}}|DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________


| '''configProperties''' [config, condition, inherit] |= Syntax
| '''configProperties''' [config, condition, inherit] |SYNTAX=


|p1= [config, condition, inherit]: [[Array]] |= Parameter 1
|p1= [config, condition, inherit]: [[Array]] |PARAMETER1=
|p2= config: [[Config]] - config entry to search|= Parameter 1
|p2= config: [[Config]] - config entry to search|PARAMETER1=
|p3= condition (Optional): [[String]] - expression, which if returns [[true]], adds current property to result. Default: "[[true]]" |= Parameter 1
|p3= condition (Optional): [[String]] - expression, which if returns [[true]], adds current property to result. Default: "[[true]]" |PARAMETER1=
|p4= inherit (Optional): [[Boolean]] - include inherited properties. Default: [[true]] |= Parameter 1
|p4= inherit (Optional): [[Boolean]] - include inherited properties. Default: [[true]] |PARAMETER1=


| [[Array]] - Array of [[Config]]s |= Return value
| [[Array]] - Array of [[Config]]s |RETURNVALUE=
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
|x1= <code>_configs = [[configProperties]] <nowiki>[</nowiki>[[configFile]] >> "CfgVehicles" >> "O_Truck_02_box_F"];</code> |= Example 1
|x1= <code>_configs = [[configProperties]] <nowiki>[</nowiki>[[configFile]] >> "CfgVehicles" >> "O_Truck_02_box_F"];</code> |EXAMPLE1=
    
    
|x2= <code>_configs = [[configProperties]] <nowiki>[</nowiki>[[configFile]] >> "RscText", "[[true]]", [[true]]];</code> |= Example 1
|x2= <code>_configs = [[configProperties]] <nowiki>[</nowiki>[[configFile]] >> "RscText", "[[true]]", [[true]]];</code> |EXAMPLE1=


|x3= Get all hitpoints of a truck:<code>_hitPoints = [];
|x3= Get all hitpoints of a truck:<code>_hitPoints = [];
Line 32: Line 32:
[[true]]
[[true]]
];
];
[[hint]] [[str]] _hitPointsCfgs;</code> |= Example 2
[[hint]] [[str]] _hitPointsCfgs;</code> |EXAMPLE2=
____________________________________________________________________________________________
____________________________________________________________________________________________


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


}}
}}

Revision as of 14:35, 7 April 2019

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
Groups:
Uncategorised

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