How to make a table variable public in a storyboard?

Hello,

I know how to make a variable be used across the scenes of my storyboard app such as storyboard.var1 = “abc”. Now I want to make a table variable such as data[1]=“abc” and data[2]=“def”.  do I have to define each one or just data[] and then use any number of it?

Thanks

I’m a bit confused about what you’re actually stuck on. If you add a table as a property of the storyboard object, you can do: 

storyboard.myTable = {} storyboard.myTable[1] = "stuff" storyboard.myTable[2] = 123  

or you can do it all at once:

storyboard.myTable = {"stuff", 123}

You CANNOT just do:

storyboard.myTable[1] = "stuff"

without first doing:

storyboard.myTable = {}

as your code will not know what storyboard.myTable is until you create it.

Does that help, or have I misunderstood your question?

I’m a bit confused about what you’re actually stuck on. If you add a table as a property of the storyboard object, you can do: 

storyboard.myTable = {} storyboard.myTable[1] = "stuff" storyboard.myTable[2] = 123  

or you can do it all at once:

storyboard.myTable = {"stuff", 123}

You CANNOT just do:

storyboard.myTable[1] = "stuff"

without first doing:

storyboard.myTable = {}

as your code will not know what storyboard.myTable is until you create it.

Does that help, or have I misunderstood your question?