inheritsFrom: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(example result)
m (template:command argument fix)
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Returns base entry of config entry.  |= Description
| Returns base entry of config entry.  |DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________


| '''inheritsFrom''' config |= Syntax
| '''inheritsFrom''' config |SYNTAX=


|p1=  config: [[Config]] |= Parameter 1
|p1=  config: [[Config]] |PARAMETER1=


| [[Config]] |= Return value
| [[Config]] |RETURNVALUE=
____________________________________________________________________________________________
____________________________________________________________________________________________
|x1 = <code>_base = [[inheritsFrom]] ([[configFile]] [[gtgt|>>]] "CfgVehicles" [[gtgt|>>]] "Car");</code> Result is [[Config]] entry for class "LandVehicle" |= Example 1
|x1 = <code>_base = [[inheritsFrom]] ([[configFile]] [[gtgt|>>]] "CfgVehicles" [[gtgt|>>]] "Car");</code> Result is [[Config]] entry for class "LandVehicle" |EXAMPLE1=


|x2 = Print parent tree of given config class:<code>fnc_printParents =
|x2 = Print parent tree of given config class:<code>fnc_printParents =
Line 50: Line 50:
// Example:
// Example:
([[configFile]] >> "CfgVehicles" >> [[typeOf]] [[player]]) [[call]] fnc_printParents;</code>
([[configFile]] >> "CfgVehicles" >> [[typeOf]] [[player]]) [[call]] fnc_printParents;</code>
[[Image:inheritsFrom.jpg|left|300px]] |= Example 2
[[Image:inheritsFrom.jpg|left|300px]] |EXAMPLE2=




| [[configFile]], [[config/name]], [[configName]], [[count]], [[getArray]], [[getText]], [[getNumber]], [[isArray]], [[isClass]], [[isNumber]], [[isText]], [[select]], [[configHierarchy]], [[isKindOf]] |= See also
| [[configFile]], [[config/name]], [[configName]], [[count]], [[getArray]], [[getText]], [[getNumber]], [[isArray]], [[isClass]], [[isNumber]], [[isText]], [[select]], [[configHierarchy]], [[isKindOf]] |SEEALSO=


}}
}}

Revision as of 15:41, 7 April 2019

-wrong parameter ("Arma") defined!-1.00
Hover & click on the images for description

Description

Description:
Returns base entry of config entry.
Groups:
Uncategorised

Syntax

Syntax:
inheritsFrom config
Parameters:
config: Config
Return Value:
Config

Examples

Example 1:
_base = inheritsFrom (configFile >> "CfgVehicles" >> "Car"); Result is Config entry for class "LandVehicle"
Example 2:
Print parent tree of given config class:fnc_printParents = { disableSerialization; if (!isClass _this) exitWith {hint "Argument is not a config Class"}; private _parents = []; while {!isNull _this} do { _parents pushBack configName _this; _this = inheritsFrom _this; }; reverse _parents; private _tv = findDisplay 46 createDisplay "RscDisplayEmpty" ctrlCreate ["RscTree", -1]; _tv ctrlSetPosition [0,0,1,1]; _tv ctrlSetBackgroundColor [0,0,0,0.5]; _tv ctrlCommit 0; private _path = []; { _tv tvAdd [_path, _x]; _path pushBack 0; } forEach _parents; tvExpandAll _tv; }; // Example: (configFile >> "CfgVehicles" >> typeOf player) call fnc_printParents;
inheritsFrom.jpg

Additional Information

See also:
configFileconfig/nameconfigNamecountgetArraygetTextgetNumberisArrayisClassisNumberisTextselectconfigHierarchyisKindOf

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

Notes

Posted on Apr 2, 2014 - 17:11
ffur2007slx2_5
(A3 1.14)Use BIS_fnc_returnParents if a parents' collection of the given entry is needed. [(configFile >> "CfgVehicles" >> "Land_Atm_02_F"),true ] call BIS_fnc_returnParents; //return: ["Land_Atm_02_F","House_Small_F","House_F","House","HouseBase","NonStrategic","Building","Static","All"] Not all entries have parent, and please differ parents from path. inheritsFrom (configFile >> "CfgUIColors" >> "IGUI" >> "Presets" >> "PresetA1" >> "Variables"); //return: Nothing

Bottom Section