lua-users home
lua-l archive

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


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