I am getting tricked up with arrays and nested arrays.
I would like this if statement to evaluate to True if lastObject doesn'texist, or if accelerometer.x - lastObject[0] > .1
My code doesn't do this.
if (![accelerometerArray lastObject] ||
[NSNumber numberWithDouble:acceleration.x] -
[[accelerometerArray lastObject] objectAtIndex: 0] > [NSNumber numberWithDouble:.1)
{
NSArray *entry = [[NSArray alloc] initWithObjects:
[NSNumber numberWithDouble:acceleration.x],
[NSNumber numberWithDouble:acceleration.y],
[NSNumber numberWithDouble:acceleration.z],
[NSDate date]];
[accelerometerArray addObject: entry];
[entry release];
}