array in array 中的目标元素,Lua

Target element in array in array, Lua

所以我是 lua 的新手,我不知道如何在数组中定位数组中的元素。

table 和数组一样吗?为什么数组和对象具有相同的语法?有区别吗?

只需多次使用 table-索引运算符,例如:

local data = { { "northwest", "north", "northeast" },
               { "west",      nil,     "east"      },
               { "southwest", "south", "southeast" } }
print(data[2][3])  -- prints east

关于 tables、数组、对象等的混淆:Lua 没有“数组”。 Lua 没有“对象”。对于结构,Lua只有table,可以作为数组,或者作为对象 ——但对 Lua 来说,它是 table。他们就是你创造的。