lua-users home
lua-l archive

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

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.

I'm happy with my own simple wrapper, I just want to get the details correct.

On Tue, Nov 12, 2013 at 12:09 PM, Liam Devine <> 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.