lua-users home
lua-l archive

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


Does the function you are calling tolerate a NULL callback? Making a
nil check does remove a bit of safety from the API... abou point two,
I agree that I have to make callbacks act like alien functions and
respond to the same API after created.

About Alien vs lua-gtk, Alien is not supposed to be used raw, it is a
tool for experimenting with a C library, even on the Lua REPL, and
writing higher-level extensions without having to write C wrappers
first (think of it as a dynamic version of tolua). You still need to
worry about the portability of the code you are writing, that is why I
provide the alien.platform variable, and you still need to be careful
or it will segfault on you. You can find an extension I have been
writing (eating your own dogfood and all that :-) ) on
http://alien.luaforge.net/aio-current.tar.gz to see what I mean.

--
Fabio Mascarenhas

On Thu, Feb 14, 2008 at 1:57 AM, Thomas Harning <harningt@gmail.com> wrote:
>  I've decided to try using Alien as a unit testing platform for a C
>  library I wrote.  While working on this I found a few deficiencies......
>   * callbacks cannot be nil  - relatively easy to patch... in
>  alien_check_callback, check for nil and return NULL if so... [I think
>  thats right...]
>   * callbacks cannot be passed into a callback...
>     EX: I have a callback that receives a 'next' callback that is to be
>  called with results (and can be called multiple times, so return value
>  cannot be hacked in well.)
>     API suggestion: anonymous callbacks should be able to accept the
>  :types  function to apply types and make them callable.
>