lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Aug 15, 2014 at 2:01 PM, Jan Behrens <jbe-lua-l@public-software-group.org> wrote:
> >> If we assume that nil's are allowed as values, then calling the length
> >> operator here (even if it's just for a few nil elements) would require
> >> the underlaying SQL library to iterate through all result rows to
> >> return a length.
> >
> >
> > No, you simply need to return the current index + 1 to continue the loop.

I don't understand what you mean with "simply returning the current index + 1"?

When length is requested for the "result set" or whatever object is the subject of the iteration, "lie," and return the number of elements processes so far, plus one. This will cause the loop to continue to the next iteration.

e