lua-users home
lua-l archive

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


Actually, the semantics here are identical to Python's - read goes to
"nearest" variable scope (local if there's a local value, global otherwise)
and writes go to local scope unless told otherwise.

Or am I misunderstanding how this works?

-Chris

----- Original Message -----
From: "Edgar Toernig" <froese@gmx.de>
To: "Multiple recipients of list" <lua-l@tecgraf.puc-rio.br>
Sent: Wednesday, January 31, 2001 12:15 PM
Subject: Re: Son of Lua - Sol


> Hi,
>
> "Russell Y. Webb" wrote:
> >
> > b = 10
> > c = 1
> > function test(x)
> > global c;
> >     b = "this does not change the global";
> >     c = "but this does";
> >     print(10); -- this uses the read access to globals
> > end
> >
>
> I thought about this myself.  But it complicates the parser a lot.
> (Especially: a,b,c,d=foo4()  where a and d are new locals, b an old
> local and c a global).  And you may get some strange semantics.
> Are your patches anywhere to have a look at?
>
> Ciao, ET.
>