Any way to track the 'parent' path of a library?

Is there any built in functionality that allows for sections of a library to look back at their path ancestry (in order to locate an immediate parent library)?

I know a solution to this, but it involves iterating through an entire library to locate a match. I would much rather not.

Visualized:
image

Say that I create a local and set its value to B[X][X’] (the value of X’). The moment that I do this, the local becomes independent. Because it is separated from its grandparent “B”, it has become its own root. I want to match X in the library from the local that I’ve created (X’).

How should I approach this?

Any information would be greatly appreciated.

I don’t know.

Does this help?

Instance:GetFullName (roblox.com)

1 Like

Not quite, but very similar. Rather than finding the ancestry of an instance, I’m looking for the path/ancestry of an object in a luau library.

By library are you referring to a hierarchy of ModuleScript instances?

What data type is “X’?” If it is a table or can be cast to a table, you could feasibly set up the parent-child hierarchy that ROBLOX uses with Instances with your library structure instead. If your library cannot be structured as all values being tables, though, then you can’t really point backwards. Tables only drill down by default.

Alternatively, you can define the “parents” as variables in the same scope you define X’, but that is not a very expandable method.

1 Like

Much thanks.

I was using tables with dictionaries. I bit the bullet and decided to iterate through the descendants of the dictionary values in order to “match” a value that contained the library that I started with.