2.6 Releasing Objects

LuaCOM

next up previous contents Next: 3. LuaCOM Elements Up: 2. Tutorial Previous: 2.5 Methods and Properties   Contents

2.6 Releasing Objects

Objects are automatically released using Lua's garbage collection mechanism, that is, when there are no references to them in Lua. However, some objects may demand an explicit termination method call, like ``Quit''.

obj = luacom.CreateObject("MyApp.MyObj")
-- Here we force an immediate release of the object
obj = nil
collectgarbage()

Notice that if there is any references to the COM object alive in Lua then the application (or library) that implements it will not exit.



Fabio Mascarenhas de Queiroz 2005-01-07