lua-users home
lua-l archive

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


Hi Ariel,

Attached is a patch for tolua++ that enables try / catch hooks in tolua++
(It also corrects one bug when using casts with templates).

Also attached is an example of hook file.  It will envelope every function
call made by tolua++ ina a try / catch block that converts the exception to
a lua error.

Changing subject a little bit, is there any new distributions of LuaQt for
newer versions of the library?

Carlos Augusto.

> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br
> [mailto:lua-bounces@bazar2.conectiva.com.br]On Behalf Of Ariel Manzur
> Sent: Thursday, August 16, 2007 5:30 PM
> To: Lua list
> Subject: Re: Binding C++ functions that 'throw' exceptions
>
>
> The thing about exceptions is that I rarely use them, so I never spent
> much time thinking about it.. I've seen a number of implementations,
> CEGUI seems to be one that supports most cases, but the syntax to bind
> them deviates too much from the way exception are defined on a
> standard header, which is why I hesitate about merging it into
> tolua++..
> If there's a way to add them using hooks, I'd love to take a look at
> that.. in fact I should probably get all the options together, maybe
> on a wiki page, and get opinions from the users to determine which one
> to implement..
>
> sorry for not providing a solution on this.. most of the tolua++
> development is based on my real world usage of it, so some areas are
> lacking (C arrays come to mind)..
>
> Ariel.
>
> On 8/16/07, Olivier Delannoy <olivier.delannoy@gmail.com> wrote:
> > In CEGUI (cegui.org.uk) there is a modified version of toLua++ which
> > handle exception in a user define behavior specified in the pakage
> > file.
> >
> >
> > On 8/16/07, RJP Computing <rjpcomputing@gmail.com> wrote:
> > > On 8/16/07, Thomas Breuel <tmbdev@gmail.com> wrote:
> > > > We're having the same problem, and I asked about this a few
> days ago;
> > > unfortunately, there has been no official answer from the
> Lua, tolua, or
> > > tolua++ maintainers yet.
> > > >
> > > > Unless we hear about anybody else working on an official
> solution soon,
> > > we're probably going to start modifying tolua++ (there are some other
> > > features we need as well).  I believe all tolua++ needs is to
> have a couple
> > > of hooks added so that the exception handlers can then be
> implemented as a
> > > loadable tolua++ extension (we're using tolua++ because of
> its improved
> > > garbage collection).
> > > >
> > > > Cheers,
> > > > Thomas.
> > >
> > > Is there any way I can get my hands on this or even help
> where I can? I was
> > > thinking of doing that exact implementation to fix the
> problem. It seems
> > > like a waste of effort. What do you think?
> > >
> > >  The solution you describe seems to be the cleanest and most
> universal fix.
> > > It allows for the most flexibility. I was also thinking that
> you need to
> > > specify the exception in the .pkg file.
> > >
> > >  example:
> > >  void MyFunction( someParameter ) throws
> > >
> > >  or maybe:
> > >  void MyFunction( someParameter ) throws ExceptionType
> > >
> > >  I have not even started to look at the design of toLua++ yet
> so I don't
> > > know, if in the second example, the type is even useful. It was just a
> > > couple of thoughts.
> > > --
> > > Regards,
> > > Ryan
> > > RJP Computing
> > >
> >
> >
> > --
> > Olivier Delannoy
> > ATER
> > PRiSM Laboratory
> > Versailles University, FRANCE
> >
> No virus found in this incoming message.
> Checked by AVG.
> Version: 7.5.484 / Virus Database: 269.11.19/956 - Release Date:
> 8/16/2007 9:48 AM
>
No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.484 / Virus Database: 269.12.0/958 - Release Date: 8/17/2007
2:31 PM

Attachment: tolua++-1.0.92-fixes.patch
Description: Binary data

Attachment: hook_example.lua
Description: Binary data