Reputation: 164
The following code works as expected:
local t = {} print(t[1])
The above will print nil. How come the following code results in an error?
print({}[1])
What is the logic behind this?
Upvotes: 1
Views: 73
Reputation: 7064
You can:
print(({"a", "b", "c"})[2]) -- "b"