lua-users home
lua-l archive

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

Hi Alexander,
CEGUI use a modified version of tolua ++ for this purpose. I think
most exceptions are already handle at the moment. If you still have
some uncaught exception please contact us on #cegui at or on the forum we will fix this in the upcomming

To discuss more the solution used in the modified version of tolua++,
we have add some properties to the description of a function or a
method to define whether the exception must  be transformed to an
error or a return value nil for pointer.


On 6/13/06, Christian Vogler <> wrote:
Hi Alexander,

> To do this we want to generate new bindings for this library with
> patched toLua++ (using existing .pkg files). Where is the best place
> to patch toLua++ to generate try-catch blocks around calls to bound
> code?

I did this for tolua 4.0, and tolua++ probably still uses the same mechanism.
The places are in function.lua and variable.lua.

In function.lua: right before the "-- check types" (open a try) and before
the "output("}")" at the end of the same function (close a try).

In variable.lua: right after the "output("{")" and before the "output("}")"
(open and close a try, respectively).

This is pretty easy to do ...

One word of warning: doing things this way can really increase the size of the
compiled binaries. IMHO, in the long run, it would be better to patch Lua to
be exception-safe, and to compile it as C++ code. This topic has been raised
several times on the list, so you should be able to find instructions

Best regards
- Christian
Christian Vogler, Ph.D.
Research Scientist, Gallaudet Research Institute