lua-users home
lua-l archive

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


On Tuesday, August 09, 2011 06:22:27 PM Lars Doelle wrote:

> -- demonstrating the glitch on locals --
> 
> local a
> 
> a,a = 1,2 -- 'a' is assigned 1 and not 2
> 
> check(a,"local ","a")
> 
> -- This behaviour is at least unexpected, since the assignment
> -- intuitively should have the same meaning as
> 
> a = 1
> a = 2

Can anyone explain the benefit of:

a, b = 1, 2

The only place I've seen the slightest benefit of that was when 
capturing the return of functions returning multiple values.

Thanks

SteveT

Steve Litt
Author: The Key to Everyday Excellence
http://www.troubleshooters.com/bookstore/key_excellence.htm
Twitter: http://www.twitter.com/stevelitt