lua-users home
lua-l archive

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


> On Thu, Feb 25, 2010 at 01:25, Roberto Ierusalimschy
> <roberto@inf.puc-rio.br> wrote:
> > Of course, you can write "loadin(_ENV, string)" and then make the
> > string share the lexical scope of its call site. But you must pass _ENV
> > explicitly; nobody can access it outside its lexical scope (except using
> > the debug API).
> 
> I'm sorry to pollute the discussion with a n00b question, but I don't
> understand how changing the environment affects lexical scope...
> 
> [...]
> 
> But after reading your answer, I'm puzzled:
> 
> would
> local a = 1
> loadin(_ENV,"a=2")
> 
> change the value of the local, or create _ENV.a? From what I
> understand I'd say the latter, but I understand " "loadin(_ENV,
> string)" [will] make the string share the lexical scope of its call
> site " as the former...
> 
> Could you enlighten me?

My mistake. Sorry about that.

  > Of course, you can write "loadin(_ENV, string)" and then make the
- > string share the lexical scope of its call site. But you must pass _ENV
+ > string share the environment of its call site. But you must pass _ENV
  > explicitly; nobody can access it outside its lexical scope (except using
  > the debug API).

-- Roberto