[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Userdata Lifetime Management (was Prevent userdata from being marked for garbage collection?)
- From: Vinnie Falco <vinnie.falco@...>
- Date: Tue, 3 Jul 2012 19:37:42 -0700
> Date: Wed, 04 Jul 2012 00:24:34 +0200
> From: Carsten Fuchs <carsten.fuchs@cafu.de>
> Subject: Prevent userdata from being marked for garbage collection?
>
> my preferred way of binding C++ objects to Lua has always been the direct and
> lightweight way...
>
> A key feature of this approach is that Lua determines the lifetime of the C++ object...
In my update to LuaBridge, I added support for three styles of
"Lifetime Management" which directly address the use-cases you
described:
- Lua lifetime: Managed completely by Lua
- C++ lifetime: Managed completely by C++
- Shared lifetime: Reference counted with your choice of compatible container.
These lifetime models are fully documented in the LuaBridge README:
https://github.com/vinniefalco/LuaBridge
Specifically:
https://github.com/vinniefalco/LuaBridge#c-lifetime
https://github.com/vinniefalco/LuaBridge#lua-lifetime
https://github.com/vinniefalco/LuaBridge#shared-lifetime
The LuaBridge Demo graphical application (which works on most
platforms) has example code for creating objects using all the various
lifetime models, using the provided reference counted containers:
https://github.com/vinniefalco/LuaBridgeDemo
If you have questions feel free to contact me or open an Issue on Github.
Thanks
--
Follow me on Github: https://github.com/vinniefalco