lua-users home
lua-l archive

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


On Mon, Jul 12, 2004 at 07:48:00AM +0200, Kaos wrote:
> Jamie Webb wrote:
> >On Sat, Jul 10, 2004 at 06:44:21PM +0200, Markus Huber wrote:
> >>-- Wich version is better and why? Any suggestions are welcome.
> >[snip] In fact, as written, it won't work at all. The declaration of
> >Lines needs to be moved outside the loop.
> I would agree, if it wasn't for the ... or {} part, which I actually 
> think would make it work as intended (not tested).

Nope. That line will just always be equivalent to 'local Lines = {}',
i.e. all lines will be discarded immediately after they are read. The
problem is that because Lines is declared inside the loop, its scope
does not extend across iterations.

-- Jamie Webb