Ok I am missing something somewhere and stuck. I have an app i’m building for a client that on one of the pages pulls data from an online XML file. The file gets saved to the tmp directory, then parsed. Everything worked wonderful until I tired to add a new bit of data. When the parser hits a child that is empty it throws a nil error like so…
Runtime error
…ilE/Dropbox/Royal Bliss Mobile - Final/ios7/tour.lua:184: attempt to index field ‘?’ (a nil value)
After hitting the nil child the whole thing crashes. I tried a IF statement like so…
[lua]
for i=1,#event do
local eventVenue = event[i].child[14].child[1].value
local eventCity = event[i].child[5].value
local eventOpener = event[i].child[13].child[2].child[1].value
if (eventOpener == nil) then
eventOpener = “None Specified In Database”
end
[/lua]
this line…
[lua]local eventOpener = event[i].child[13].child[2].child[1].value[/lua]
Is the child that does not always have data in it. I know the problem is with my IF statement and not understanding how to get past the nil value, I’m just not sure of what to try next.
Thanks in advance for any help anyone can give on this