|
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 <liamdevine@oolua.org <mailto:liamdevine@oolua.org>> wrote: On 12/11/13 16:00, Marc Lepage wrote: Basically, I'm trying to ensure there can only ever be one full userdata 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. -- Liam
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 > correct.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.
-- Liam