Think of arrays/dictionaries as just grouped variables (tables) that can be transferred anywhere. But they are slightly different in what they try to accomplish. They are both tables though at heart.
The scripting definition for a dictionary is just an array with an index that isn’t a number contained within the array. It’s used to better label information, instead of sorting it, unlike an array.
So an example dictionary is
x = {}
x.workspaceObject = game.Workspace
You can now refer to workspace with this
print(x.workspaceObject) --> Workspace
baseplate = x.workspaceObject.Baseplate --> We can also access instances inside the workspace.
This line of code is also doing the same thing, just a different way of doing it. It’s mainly there to allow you to more neatly input objects that aren’t supported by the dot (.) operator, such as instances.
x["workspaceObject"]=game.Workspace
Dictionaries are cool. Because you can also assign instances as indexes too! Everything in the explorer is an instance by the way.
x={}
workspace=game.Workspace
x[workspace]="Hi!" --making the index of the value "Hi!" game.Workspace, using our variable workspace
print(x[game.Workspace]) --> Hi!
So if you wanted to store a TARDIS, you’d do this.
Exterior = game.Workspace.Tardis.Exterior
Interior = game.Workspace.Tardis.Interior
local _List = {TARDIS1 = {Exterior = Exterior, Interior = Interior}}
And to understand how to access said information is very simple.
print(_List.TARDIS1.Exterior) -- will give us the game.Workspace.Tardis.Exterior, since we defined Exterior as _List.TARDIS1.Exterior previously
To describe an array, it’s just the same thing as a dictionary but more simple. There are only numbers as indexes. The values can be anything however, tables, functions, and the like. They are used for sorting information unlike dictionaries, because you can use the “#” operator on them, unlike dictionaries. Which is the primary distinction between the two.
z={[2] = true}
z[1] = "Hi!"
print(z[1]) --> Hi!
print(z[2]) --> true
print(#z) --> 2, because there are two different indexes, that lead to two values.
Please reply with any questions.