Reputation:
Lets imagine this:
tree = {}
tree.__newindex = tree
num = math.random(5,5)
tree.meta = {}
What I want to do here is replace the 'meta' in tree.meta with the var num without it creating a new object just simply called num. That way I can do something like tree.01415 for example. Maybe there is some syntax that I can put in there to designate meta as the variable num?
Upvotes: 2
Views: 261
Reputation: 48
If I understand you correctly, I think this is what you want:
tree[num] = "whatever"
Then whatever
will be added to table tree
with the value of num
as its key.
Upvotes: 2