lua-users home
lua-l archive

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


Can someone please explain the following.

Given:
t={"hi"}
for k,v in t do f=function() print(v) end end
f()

Actual output:
nil

Expected output:
hi

How do I create the function closure with the value v has when the
closure is created?

Thanks,

Curt