lua-users home
lua-l archive

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


On Thu, Oct 30, 2003 at 11:47:57PM -0800, Taj Khattra wrote:
> > How do I create the function closure with the value v has when the
> > closure is created?
> 
> for k,v in t do local _v=v; f=function() print(_v) end end

actually, this works too:

for k,v in t do local v=v; f=function() print(v) end end

-taj