lua-users home
lua-l archive

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


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.)

Ciao, ET.


PS: I'm really curious on how you implement these new scoping
rules without loosing performance.