Tree.lua is a tool to navigate between instances using their properties and attributes, these functions are to extend the functionality of the Roblox Engine's built in navigation tools. https://www.roblox.com/library/9179877616/Tree
Example Usage: EG 1: Look for the first child inside the parent with the Emotion attribute and a value of happy.
print(Tree.FindFirstChild(script.Parent, {
{"Attribute", "Emotion", "happy"}
}))
EG 2: Find the first ancestor called CarHOLDER
.
print(Tree.FindFirstAncestor(script, {
{"Property", "Name", "CarHOLDER"}
}))
EG 3: Find the first ancestor with a script child called MyParentIsTheHolder
.
print(Tree.FindFirstAncestor(script, {
{"Tree", "FindFirstChild", {
{"Property", "Name", "MyParentIsTheHolder"};
{"Property", "ClassName", "Script"};
}};
}))
EG 4: Find the first ancestor which is a model with a module script called A-Chassis Tune
, this module script must have a Plugins
folder inside it.
.. This may look complex, but just to prove it's possible.
print(Tree.FindFirstAncestor(script, {
{"Property", "ClassName", "Model"};
{"Tree", "FindFirstChild", {
{"Property", "Name", "A-Chassis Tune"};
{"Property", "ClassName", "ModuleScript"};
{"Tree", "FindFirstChild", {
{"Property", "Name", "Plugins"};
{"Property", "ClassName", "Folder"};
}};
}}
}))