Originally Posted by stAjora
Thanks for the info. I got it working perfectly. Now I have a new issue where I have a few nested tables and at the end is a boolean, I ca'nt seem to check this value.
Code:
for key, value in pairs(table.table2.table3) do
if(value == true) then
d('true')
elseif(value == false) then
d('false')
end
end
|
I may be missunderstanding, but from the way you phrased it, is the boolean the only value in table3 ?
Do you know the name of the boolean? like:
Lua Code:
table = {
table2 = {
table3 = {
booleanIWantToCheck = true,
}
}
}
-- If so then you can check it with:
if table.table2.table3.booleanIWantToCheck == true then
-- do whatever
end
Using paris loops through every object in table 3, which is probably not what you want.
Like if you had:
Lua Code:
table = {
table2 = {
table3 = {
otherBoolean = true
booleanIWantToCheck = false,
someString = "hello",
}
}
}
using pairs(..) like you did would loop through all of those values: otherBoolean , booleanIWantToCheck , someString checking if each one is true or false.