lua-users home
lua-l archive

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

"GrayFace" <> wrote:
> Except for one - metatable. The most 'shallow copy' way is to keep the same 
> metatable, but it may be good to make an exception: if the original table is 
> its own metatable, the new table should also become its own metatable.

Well, the point here is exactly that there is no single "best way" to do
these things. What is a "most" shallow copy? Or a "slightly less"
shallow one?

My reasoning when I put this t:xyz(...) metatable stuff in place was
(and is) that it should work *out of the box* as it does for strings and
files. Any fiddling with metatables beyond that is and always will be
the responsibility of the user/programmer.

> ----- Original Message ----- 
> From: steve donovan
> To: Lua list
> Sent: Friday, November 13, 2009 4:38 PM
> Subject: Re: little questions
> On Fri, Nov 13, 2009 at 12:33 PM, Thomas Lauer <> 
> wrote:
> > It's not that easy. First, Idle only ever creates a metatable and
> > initialises __index for tables created via an explicit call to
> > Tables created via t={} are plain tables w/o a metatable.
> > So there's a choice to start with.
> Sorry, Thomas, then I misunderstood. Having it explicit removes all 
> objections.
> steve d. 

cheers  thomasl