[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: attaching garbage collect callback to arbitrary cdata
- From: Choonster TheMage <choonster.2010@...>
- Date: Wed, 18 Sep 2013 07:47:55 +1000
On 17 September 2013 17:08, Thijs Schreijer <email@example.com> wrote:
>> -----Original Message-----
>> From: firstname.lastname@example.org [mailto:email@example.com] On
>> Behalf Of Rafis DoctorInfo
>> Sent: dinsdag 17 september 2013 8:40
>> To: Lua mailing list
>> Subject: attaching garbage collect callback to arbitrary cdata
>> I'm trying to attach garbage collect callback to cdata<unsigned int>, but
>> it is not working "bad argument #1 to 'gc' (invalid C type)". It only
>> works then attaching to pointer based cdata.
>> local ffi = require("ffi")
>> local uint = ffi.gc(ffi.new("unsigned int", 123), function()
>> print("__gc called")
>> t = nil
>> But why it is not possible? cdata and Lua's nil are different types:
>> type(cdata) ~= type(nil). Why can't LJ2 handle this?
> I don't have the answer to your question, but you might be better of asking this question on the LuaJIT mailing list  instead of the Lua list.
>  http://luajit.org/list.html
They've actually asked on both lists. There have been a few answers on
the LuaJIT list.