[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Abusing Lua iterators for fun and profit
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 6 Feb 2015 16:53:10 -0200
> Sounds like a non-compliant implementation to me.
> >and Roberto:
> >>I guess the best solution is not to use lines/gmatch at all, but
> >>read/match (or find). See  for something similar.
> >> http://www.lua.org/pil/7.1.html
> This says nothing about the reference manual, tho. (or am I missing
I don't think you are missing something. My point has nothing to do
with the manual. I just prefer the solution without 'lines'/'gmatch',
independently of whether you need to keep a state. (I think it is
simpler, because 'read' is simpler than 'lines' and 'find'/'match'
is simpler than 'gmatch'.)
Otherwise, I guess the manual is clear about these two functions
returning only an iteration function that can be called (with no
specifed parameters) to get a "next" element.