I need to get values from a nested table in Lua, I just can’t figure out how to do this, I tried a lot of online examples, but nobody works.
Any help would be appreciated
Table
xy = { a={x=0,y=0},b={x=0,y=100}, c={x=0,y=200}}
if unpack (route) contains a and c, how can I get the x, y values from the above table.
I tried
for _, v in pairs(xy) do
print(v[1], v[2])
end
But all that I will return is nil
source
share