Lua中的表内表 [英] table inside table in Lua
本文介绍了Lua中的表内表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取表中表的数据,我的意思是这样的:
How can I get the data which is a table inside a table, i mean like this:
t = { {a, b, c}, {d, e, f} };
如果我写这行代码:
print( t[1] )
结果将是 —–>>> {a, b, c}
the result will be —–>>> {a, b, c}
但是
如何只打印字母a"?不使用 ipairs
我的意思是有没有办法使用类似 t[1]
的东西?
how can I print just the letter "a"? without using ipairs
I mean is there any way to use something like t[1]
?
推荐答案
您是否尝试过 t[1][1]
?这应该为您提供从 t[1]
Have you tried t[1][1]
? That should get you the first index in the table you get from t[1]
这篇关于Lua中的表内表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文