lua-users home
lua-l archive

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


PA wrote:
  table.foreach(node, function(k,v) b[k]=clone(v) end)


Stylistic question:

What would be the benefit of using a closure in this case?

Wouldn't a simple iterator achieve the same effect?

for k,v in pairs(node) do b[a]=v end

Do the enclosure add anything in this case?
probably not - i was just cut&paste the original code.

the real answer is cost of iterator vs cost of callback : profile it & see...(i don't know the answer)

Adrian