[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Error handling in C
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 14 Oct 2003 23:46:09 -0200
>How can I go about handling errors that occur in the lua_dofile
>function? If the function fails, it outputs to stderr (which I'd like
>to prevent) and provides no indication that failure has occurred. Is
>there any way I can suppress the output of the error message, discover
>whether an error occurred, and retrieve the error string that would
>normally be written to the console upon failure?
Yes, redefine _ALERT.
However, this works only for compatibility. In Lua 5.1, lua_dofile will be
removed and a luaL_dofile will be provided that works like lua_loadfile,
that is, it returns an error message on the stack in case of errors (be they
compilation or execution or another error).