Tree.lua
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
Please consider continuing on GitHub to support this project.
VIEW THE WIKI, WHICH CONTAINS ALL DOCS.
The following examples are to show you what Tree can do, not teach you how to use it.
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", "ITSMYPARENT"};
{"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"};
}};
}}
}))