lua-users home
lua-l archive

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


Edgar Toernig wrote:
> 
> Roberto Ierusalimschy wrote:
> >
> > Simply like this:
> >
> >   for k, v in tab do
> >     local v = v
> >     actors[k] = function (x) act_on(v, x) end
> >   end
> 
> Just a question: would the line "local v=v" be necessary or would
> you only get a different semantic without it?  (Without it, all v's
> in the function are the same var, with the local line each function
> gets it's own v.)

Upps... forget it.  It doesn't make much sense here if all functions
would get the same v - it would just hold the value of the last element.

Ciao, ET.