Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I get the "Parent" of a table?

Asked by 3 years ago
Edited 3 years ago

For example, say we have this:

Table1 = {Table2 = {} }

If I only had Table2, how do I get Table1?

1 answer

Log in to vote
0
Answered by
Speedmask 661 Moderation Voter
3 years ago

unfortunately, that's impossible :) you'll have to store that information somewhere else. you can also look into a metatable which is a little bit different but could still work depending on your use case. for example:

cool = {"dope"}
boring = {"not dope"}
setmetatable(cool, boring)
print(cool, getmetatable(cool))
-- {"dope"}, {"not dope"}

it gets more complicated than that but those are the basics of it

Ad

Answer this question