lua-users home
lua-l archive

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

>  Mon, 25 Nov 2002 15:19:54 -0200
>  Luiz Henrique de Figueiredo <> wrote:
>  We're trying to decide the future of tolua and we'd like to hear your opinion.
>  If you use tolua (or something else) to automatically bind C or C++ code to Lua,
>  please fill in the brief survey below and send it directly to us at
> .
>  Thanks for your time.
>  --lhf and celes
>  * Do you use tolua? If not, do you use any other wrapper?

Yes, I start using it now  for our new major release instead of custom
bindings which  demanded lots  of code. I  created a wrapper  I called
LuaBind with a  few "keywords" in C which parses a  marked up C header
(still valid  C), generate  a pkg description  and pipes it  to tolua.
May be  this could be  one solution for  the wishes of  several people
here which do want to maintain  exactly one source as C/C++ header and
Lua binding description.

I dived a little  bit into swig.  What I really like  with swig is the
ability to  generate wrappers for different  languages. However, there
seem to be some caveats:

* those guys did several major rewrites of the code, on the way changing
  its purpose  -- e.g. they dropped the documentation system. A possible 
  reason is that, initially, they wanted put too much stuff into it.

* Lua support is not well developed. Of course, a little engagement in
  that  community could solve the probelem, at the other hand ther seems 
  to be quite intense proces of API changes, so this investment is possibly
  not save.

* At present, swig does not allow co-existence of two or more language 
  bindings in one executable -- this is mainly an issue of namespaces
  of linker symbols. 

So I decide to stick to tolua, as it does the job. Using some COM style
refcounting in C, it was possible to put all C objects exposed to Lua
under garbage collection.
>  * Do you use tolua for C or C++?

Currently C, but C++ is not excluded for the future.

>  * What features do you miss in tolua?

Support.   It  seems  to  be  less well  supported  than  Lua  itself.
Concerning the other stuff, I trust  you guys that you would do a good
job on it as you did with Lua itself :-)

>  * How could tolua be improved?
Most suggestions are already in the thread:

- parse  headers -- possibly tagged somehow -- instead of pkg files. 
  The main issue however is to be able to maintain one source for interface
  description. So  in principle, we could go vice versa: Maintain an
  Interface Description and  extract C headers as well as Lua bindings 
  from that one. This rings a bell in my head: CORBA IDL is some standard
  in this field...

- Make type checking optional.  

- Do something with documentation. But be careful  (see the swig stuff above) --
  Possibly more important it is to keep things small, modular and orthogonal.


I believe that tolua is a good tool, and it is worth maintaining it as
it allows quite painlessly to glue Lua and C in a professional manner,
which for me is the main issue with Lua. 

Juergen Fuhrmann

                             Numerical Mathematics & Scientific Computing
               Weierstrass Institute for Applied Analysis and Stochastics
   Mohrenstr. 39 10117 Berlin    fon:+49 30 20372560   fax:+49 30 2044975