lua-users home
lua-l archive

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

On Wed, Feb 15, 2012 at 4:35 PM, Michal Kottman <> wrote:
> Wouldn't this extend/update always the same table? I.e. icopy/tcopy
> would be usable only once.

function icopy(t) return extend({},t) end

Yow, that's right - the table ctor makes a new table if you write it
out in the old-fashioned way!

I'll have to think about how to do this ... elegantly[1]   However, it
is not a disaster to have to type extend({},t), especially with a
better alias like 'copy' ;)

steve d.

[1]'elegance' can be a problem. I am learning Haskell and am amazed at
the dance of functions. But Haskell has to try harder because the poor
thing cannot do loops.