[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Resurrecting Objects
- From: "Liam Devine" <liamdevine@...>
- Date: Tue, 12 Nov 2013 20:19:33 -0000
On 12/11/13 19:01, Marc Lepage wrote:
In my case it's a little more complicated than a simple Lua userdata
wrapping a C++ object. In some cases, the Lua userdata "owns" the C++
object, in some cases it doesn't. I don't use shared_ptr or anything
like that to manage it. And I don't use a separate "owning" flag like
some wrappers do. I have a few bit flags in the object itself, plus some
other contextual information, that I use to make that determination when
the userdata is finalized. Also it can change over time.
On Tue, Nov 12, 2013 at 12:09 PM, Liam Devine <email@example.com
On 12/11/13 16:00, Marc Lepage wrote:
Basically, I'm trying to ensure there can only ever be one full
per particular C++ object. (Because that would simplify a lot.)
What maybe simpler is using a library that already does this for
you, unless there is truly a reason to reinvent the wheel.
Well it sounds like this is a situation which you have created, where
for some reason you want intrusive bit flags. I know of one library that
uses a none intrusive flag which can change over time, but whatever.
> I'm happy with my own simple wrapper, I just want to get the details
Be prepared to spend some amount of time over the next X years doing
this. Basically this is my point, unless there is some special need then
create your own code and let someone else worry about the binding, bug
fixes, edge cases, optimisations ... In other circles they say create
games not engines, same principle.
I am in no way suggesting a specific library, yet it just seems to be
getting to the point of ridiculous with the amount of libraries which
already take care of this C++ and Lua binding. For some unknown reason
the wheel is still something waiting to be discovered.