One simple question:
Can I have a table
t1 = {boo = true, foo = false]
include that table within another table
t2 = {x=0, y=0, t1}
???
How do access to all members in t2?
Hope you understand.
Accesing tables within tables
Re: Accesing tables within tables
Yes you can.
But if you wish to do it the way you arew doing in example, you need to do the second table in way of
t2 = {x=0, y=0, t1 = t1 }
Access to t1 would be:
t2.t1.boo
t2.t1.foo
you can have as many table dimensions as you like, and you can also assign them at once. say:
this should result in "Hello" being printed.
But if you wish to do it the way you arew doing in example, you need to do the second table in way of
t2 = {x=0, y=0, t1 = t1 }
Access to t1 would be:
t2.t1.boo
t2.t1.foo
you can have as many table dimensions as you like, and you can also assign them at once. say:
Code: Select all
table = {
[t2] = {
[t3] = {
[t4] = { message="hello" }
}
}
}
debugprint( table[t2][t3][t4].x )
Re: Accesing tables within tables
Thanks Bugala. Clear enough! I dont know what happened to the rest of the thread but I understand clearly!