terrymisu

In Corona, I see:
function self:getDuration ()
return self.frames[#self.frames - 1]
end
But in C++, I see:
float RotateTimeline::getDuration () {
return frames[framesLength - 2];
}
Is there a bug here, or is this a difference in how Corona and C++ index?

I don't know what #self.frames is doing.

What's the desire here, exactly, in English?
Avatar
terrymisu

Kickstarter Backer
  • Postovi: 136

terrymisu

Based on the code, I'm guessing this isn't a bug.

Are we trying to return the 2nd to last item in self.frames?
Avatar
terrymisu

Kickstarter Backer
  • Postovi: 136

terrymisu

Ahhh I think I figured out what's going on here...

#frames is the last element in frames in Lua, correct? (Similar to Perl)

And for C++, the frame length is the length of the list, so that explains the off-by-1.

Thankfully Python lets you index into a list backwards, so I'll just use frames[self.LAST_FRAME_TIME] where appropriate. ;)
Avatar
terrymisu

Kickstarter Backer
  • Postovi: 136

Nate

Yep, Lua is weird. :) Array indexing starts at 1!
Avatar
Nate

Nate
  • Postovi: 11855


Natrag na Editor