[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: metamethods for assignment and type conversion
- From: Adrien de Croy <adrien@...>
- Date: Tue, 14 Aug 2007 07:39:54 +1200
neither of these affect the C++ object that is wrapped by var1, var1
instead gets a new pointer to wrap (being a copy), and the old one is
*Adrien de Croy <email@example.com <mailto:firstname.lastname@example.org>> writes:
*In which case, separate functions will need to be written to deep-copy
objects... you end up with code like
var1 = var2;
My thought after reading this thread was:
var1 = var2:Duplicate(); or
var1 = var2:Copy()
If you want to modify the pointer that var1 wraps, then var1 needs to be
involved in the function that does the assignment.
I do this in some of my Lua code and it works pretty well. I find it
makes it pretty easy to tell when a new resource is allocated vs.
simply referenced in a new way.
Of course what's clear to me, may be mud to others...
Adrien de Croy - WinGate Proxy Server - http://www.wingate.com