a = {
b = {};
[b.c] = 22
}
which give "b not defined globally". Placing 'a' in front of this shows
why this is declarative.. a is not defined yet.
Also, the above code means something quite different to what you were trying
to achieve, I think. To understand, try this example:
x = { y = "z" }
a = { [x.y] = 22 }
The effect is the same as:
a = { z = 22 }
or:
a = { ["z"] = 22 }
This is, the _expression_ inside the square brackets is evaluated, and
the resulting value is used as the table key. No change is made to the
'x' table in this instance.
It's perhaps unfortunate that similar syntax is used for an assignment
statement in normal code, and for a key-value pair in a table
constructor. They really are quite distinct things.
Makes sense now, thanks for the explanation.