lua-users home
lua-l archive

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


> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br 
> [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Rici Lake
> Sent: Wednesday, September 15, 2004 6:14 PM
> To: Lua list
> Subject: Re: get_local() and "(for index/limit/stop)"

> Although undocumented, it also means that the index variable 
> can be reassigned within the loop without changing the loop 
> -- in 5.0, this behaviour was "undefined". (Whether it will 
> actually be defined in
> 5.1 is yet to be seen, but it is sometimes useful.)

 If possible it should be defined and documented.

> It may be possible to make it look like the index variable is 
> actually in scope in the for statement itself (although that 
> is technically incorrect) but I haven't looked closely at the code.

 Even though it makes me as an old C\C++ programmer feel more at home in the
debugger, it's probably not a good idea to fake it.  There is alot of value
in seeing exactly what the code is doing, but then again seeing the named
index appear and disappear while looping is disturbing.  

 Also these "(for xxx)" automatic loop locals are confusing when debugging
nested loops, but I figure I'll just show what Lua exposes and leave it at
that until I get feedback from people.


  Tom Spilman
  Co-owner | Programmer
  www.sickheadgames.com