lua-users home
lua-l archive

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


Virgil Smith wrote:
ShallowCopy(tbl, vec)

I prefer to use:
vec1 = vec2:copy();
in my object system.  Thus the default copy() method does a
shallow-copy but can be overridden by a particular class that
knows better.

Ideally I'd love:
vec1 = *vec2;
to indicate a value-copy instead of a reference-copy.  This would
be very easy to implement if Lua had a unary-multiply. :)  (I've
done it this way before with unary-minus, but obviously unary-minus
is actually useful to use as intended for some classes such as e.g.
vectors).

--Adam
--
Adam D. Moss   . ,,^^   adam@gimp.org   http://www.foxbox.org/   co:3