lua-users home
lua-l archive

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


Thomas Lauer wrote:

"Mark Edgar" <medgar123@gmail.com> wrote:
A block is not a scope -- there is no scope expect where
there is a (local) variable to have one.  The only way
for multiple definitions to have the same scope is that
they are declared in the same statement (or parameter
list).

Perhaps I misunderstand you but I think that's not the
case.

local i,j,k,dmz,x,y,z=1,2,3,0,4,5,6

local dmz=7

The two definitions of dmz have different scopes, with the
second one shadowing the first in the area of overlap.

Incidentally, if I remember correctly the priority of
same-named variables in a local statement or parameter list:

local a, a, a = "left", "middle", "right"; print(a)
right

is undefined by the reference manual, although it is
predictable in practice.

Having two parameters with the same name is almost 100% an
error

True, though perhaps not in automatically generated code.

--
Aaron

_________________________________________________________________
Need a break? Find your escape route with Live Search Maps. http://maps.live.com/?icid=hmtag3