lua-users home
lua-l archive

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

On Sat, Jun 11, 2011 at 11:48 AM, Mike Pall <> wrote:
> Javier Guerra Giraldez wrote:
>> it never calls my __tostring() metamethod. it seems that it's because
>> the cdata contains a FILE*, and not a FILE.
> It works now. Please see my other message.

great!  thanks a LOT.   trying right now...    and it works!

>> but i can't do:
>> ffi.metatype ('FILE *')
>> nor:
>> local file_tp = ffi.typeof ('FILE *')
>> ffi.metatype (file_tp, {.....})
> Nor should this work. Metatypes are always bound to the underlying
> aggregate and not to any pointer type.

yes, that's what i understood from the docs and what the error
messages tell.  it seems too much magic to my C-oriented side of
brain, but the contrary would make the Lua code really ugly.  making
LuaJIT (and FFI) to magically associate pointers is great