lua-users home
lua-l archive

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


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