lua-users home
lua-l archive

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


Doh! Missed that. Oh well - temporary fix:

        ld->PushObject(l);
        lua_getmetatable(l,-1);
        lua_setmetatable(l,-2);

:)

-----Original Message-----
From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On Behalf Of Karel Tuma
Sent: 06 November 2014 20:16
To: lua-l
Subject: Re: __gc metamethod bug

Excerpts from Chris Cummings's message of 2014-11-06 21:05:24 +0100:
> Or have I totally missed something :)
>
> -Chris

This is documented, specifically:

http://www.lua.org/manual/5.2/manual.html#2.5.1

"You mark an object for finalization when you set its metatable and the metatable has a field indexed by the string "__gc". Note that if you set a metatable without a __gc field and later create that field in the metatable, the object will not be marked for finalization. However, after an object is marked, you can freely change the __gc field of its metatable."



________________________________

Please consider the environment before printing this email :-)

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender immediately then delete this email. Any views expressed in this email are solely that of the individual and not representative of the company as a whole.

Media Molecule Limited
Company Reg No 5665849
Registered in England.

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________