Answered by
5 years ago Edited 5 years ago
So let’s say you have a Table called
1 | TableExample = { variable 1 = 123 , variable 2 = “hello, variable 3 = { variable 1 = “hello”, variable 2 = 13554 } } |
So how tables work is they assign an address to a certain block of memory.
So like if you gave me an address to a storage unit, it’s kind of like that. So when you make a table like the one I just made, you can’t access the inside values without first going to the address in memory for where those values are stored.
So for example imagine the TableExample is the storage unit, and the boxes inside the storage unit are the variabes.
So when you say how can I find the parent of a table, there isn't a way because there can be multiple tables of the same name inside of different tables. So what I mean is this:
1 | Table = { variable 1 = 123 , variable 2 = “hello, variable 3 = { variable 1 = “hello”, variable 2 = 13554 } } |
3 | Table 2 = { variable 1 = 123 , variable 2 = “hello, variable 3 = { variable 1 = “hello”, variable 2 = 13554 } } |
5 | Table 3 = { variable 1 = 123 , variable 2 = “hello, variable 3 = { variable 1 = “hello”, variable 2 = 13554 } } |
Tables don't have parents, because they are not instances in a game.
So what I mean is you would access something in the game by saying script.Parent or game.ServerStorage or game.Lighting.
Maybe in a module script but that's different....
However there is a way to make this easier for you. If you aren't going to have the same variables in different tables you can keep track of what variables are in what table by storing those in something seperate.
So like if I had this Table that I knew had variables named differently from other Tables like so:
1 | Table = { DifferentTable = { } , } |
3 | Table 2 = { TableNamedSomethingBlah = { } , } |
Instead of:
1 | Table = { DifferentTable = { } , } |
3 | Table 2 = { DifferentTable = { } , } |
Now to answer your question:
If you know the name DifferentTable but want to know the name Table in the example above you could create something to store that information on the side. So maybe another table like this:
1 | TableTracker = { DifferentTable = "Table" , TableNamedSomethingBlah = "Table2" } |
Or you can create folders or something.