a = {} x = "y" a[x] = 10 print(a[x]) -- 输出10 print(a.x) --输出nil print(a.y) --输出10
a.x表示以字符串“x”来索引table,a[x]以变量x的值来索引table