lua-users home
lua-l archive

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


> Following the new visibility rules, the `a' is visible inside the enclosed
function.
Is 'a' readonly inside the enclosed function (as with upvalues)?
Or can you modify the value of 'a' and have it changed outside the function?

John

----- Original Message -----
From: "Roberto Ierusalimschy" <rieru@delirius.cs.uiuc.edu>
To: "Multiple recipients of list" <lua-l@tecgraf.puc-rio.br>
Sent: Thursday, November 01, 2001 4:51 PM
Subject: Re: snapshot of Lua 4.1 (work)


> On Thu, 1 Nov 2001, Daniel Silverstone wrote:
>
> > Given that I've only scanned through the new manual I might have missed
it,
> > but could you possibly give me an equivalent to the following 4.0
function
> > in 4.1-work ?
> >
> > function add1(a,b)
> >  if b == nil then
> >   return function(bb) return add1(%a,bb); end
> >  endif
> >  return a+b
> > end
>
> First, you must change "endif" to "end" ;-)  Then, you simply remove the
'%'
> from the code. Following the new visibility rules, the `a' is visible
inside
> the enclosed function.
>
> -- Roberto
>
>