[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [LuaJIT FFI] Issues with cdata/ctype
- From: Duncan Cross <duncan.cross@...>
- Date: Sun, 29 May 2011 16:58:07 +0100
On Sun, May 29, 2011 at 4:54 PM, Justin Cormack
<justin@specialbusservice.com> wrote:
>> > Why cant you just add a __tobuffer metamethod to all the types?
>>
>> getmetatable(cdata) always seems to return 'ffi', currently.
>>
>
> You have to use ffi.metatype() to set a metatable. eg
> fd_t = ffi.metatype("struct {int fd;}", {__index = {close = close}, __gc =
> close})
> This can only be done on creation, but works nicely.
Yep, I'm using ffi.metatype - but the metatable you set is still not
retrieved by getmetatable(), it still just returns 'ffi' for me. (Is
it different for you? Maybe this is a bug?)
-Duncan