[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Luajit and curstom data structures
- From: Francesco Abbate <francesco.bbt@...>
- Date: Tue, 12 Apr 2011 23:08:51 +0200
2011/4/12 Mike Pall <mikelu-1104@mike.de>:
> Support for ctype metamethods has just been committed to LuaJIT
> git HEAD. Here are the docs:
>
> http://luajit.org/ext_ffi_tutorial.html#metatype
> http://luajit.org/ext_ffi_api.html#ffi_metatype
>
> Have fun -- feedback welcome!
Thank you Mike, this is great!
I've just a question, do you think it would be reasonable and/or
useful to have C API for cdata ? I mean something equivalent to
lua_pushuserdata, lua_touserdata, etc.
I understand that cdata are meant to be used in pure Lua code so the
need for the C API is generally absent but I think that C API could be
an important element to completely replace Lua userdata with cdata.
Even if FFI and LuaJIT2 can be very fast there can still be the need
to write a few function in C. For example I'm thinking to the libpng
library that require the use of setjmp for error handling, I guess
this is incompatible with a FFI access with LuaJIT2. Another reason
could be the use of legacy C functions that you don't want to rewrite,
in this case it could be useful a C API to retrieve and push cdata.
--
Francesco