Test = {
T1 = {
X = 1
Y = 1
}
}
print(Test[T1[X]])
7 replies to this topic
#1
Posted 14 April 2013 - 08:31 PM
is it possible to doing a code like this and have it print what X is = to?
#2
Posted 14 April 2013 - 08:33 PM
Yes but a better format is:
You can even do this:
test = {
T1 = {
X = 1,
Y = 2
}
}
print(test.T1.X) -- Returns 2
You can even do this:
test = {
[1] = {
text = {
val1 = "Some"
}
}
}
print(test[1].text.val1) -- returns "Some"
#3
Posted 14 April 2013 - 08:44 PM
Thanks Man/Girl/Demon Baby
#4
Posted 14 April 2013 - 08:48 PM
Yuri, on 14 April 2013 - 08:44 PM, said:
Thanks Man/Girl/Demon Baby
On topic:
If you want to iterate trough the values thus might come in hand
for identifier, value in pairs(table) do
print(tostring(identifier).." contains:"..tostring(value))
end
#5
Posted 15 April 2013 - 06:54 AM
Doing tostring(var) when printing isn't necessary, it will do it automatically for you.
#7
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











