Re: Informing luabind when my c++ created objects get deleted?

Willi Schinmeyer <[email protected]> Tue, 29 Jan 2013 17:30:25 +0100
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
Lua can delete your objects just fine. You can even have weak pointers 
in Lua (that don't keep objects from being garbage collected) by using 
weak tables.

Lua uses reference counting - when the garbage collector runs and there 
are no more (non-weak) references to the value, it will be deleted. 
luabind::object-references count as well.

And yes, once you've passed that object into Lua it could potentially be 
alive forever - it could be saved as a global variable, for example. 
That's why you'll likely need a proxy object in the first place if you 
want to control lifetime from C++.

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d