سؤال

I have a table(TableA), that has another table in it(TableB). I want to retrieve a variable that is located in TableA from within TableB. How would I go about doing this? I have tried:

tableA = {
testA = 5;

    tableB = {
        testB = tableA.testA + 1; 
    };

}

print(tableA.tableB.testB)

but get an error from within tableB that states that tableA doesn't exist.

هل كانت مفيدة؟

المحلول

tableA.testA does not exist until the definition of tableA is complete.

You need to do tableA.tableB.testB = tableA.testA + 1 after tableA is complete.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top