lua-users home
lua-l archive

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


On Mon, 10 Nov 2014 14:18:47 -0200
Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:

> > > Thank you for this information. I might just push an error string
> > > on top of the stack as a workaround before calling lua_newuserdata
> > > () until this bug has been fixed.
> > 
> > An even better solution would be to use lua_pushcfunction +
> > lua_pcall so you don't get a panic at all. A panic should not be
> > considered a routine error handling mechanism, IMO.
> 
> That is certainly the better/recommended practice (e.g., lua.c uses
> this technique).
> 
> -- Roberto
> 

But it is not planned to remove the lua_atpanic() interface? As I
previously explained, it seemed the most easy approach in my case
(if lua_atpanic would behave as intended).

I believe that wrapping all calls in lua_pcall might be annoying
overhead in some other scenarios as well, e.g. if more than one Lua
machine is created and if operations are performed on those machines
in turn. This doesn't apply to lua.c, of course.

Jan


-- 
Public Software Group e. V.
Johannisstr. 12, 10117 Berlin, Germany

www.public-software-group.org
vorstand at public-software-group.org

eingetragen in das Vereinregister
des Amtsgerichtes Charlottenburg
Registernummer: VR 28873 B

Vorstände (einzelvertretungsberechtigt):
Jan Behrens
Axel Kistner
Andreas Nitsche
Björn Swierczek