How to get and index from a table within that table

I was just wondering if there was a way to get an index of a table from within that table when instantiating it. Theoretically it might look something like this:

local testTable = {
     ["testIndex"] = 5,
     ["testIndex2"] = testTable.testIndex
}
1 Like

No, since you cant reference a table you havent finished initally defining.

Closest thing you could do is:

local testTable = {}

testTable.testIndex = 5
testTable.testIndex2 = testTable.testIndex

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.