lua-users home
lua-l archive

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


> I would use the undocumented newproxy function to create a global
> userdata and attach a __gc handler to be called when Lua closes:

> C:\Users\Peter>lua
> Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> > _X = newproxy(true)
> > getmetatable(_X).__gc = function() print "Goodbye" end
> >
> Goodbye
> ^C

Using the following code, I never see "Goodbye" printed. 

C:\Users\Mike>lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require"luacom"
> e=luacom.GetObject("Excel.Application")
> _X = newproxy(true)
> getmetatable(_X).__gc = function()
>>	e=nil -- or e:Quit()
>>	print"Goodbye"
>> end
^C


CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is confidential or proprietary to K&L Microwave, Inc. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, immediately contact the sender by reply e-mail and destroy all copies of the original message.