lua-users home
lua-l archive

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


Thanks for the explanation, but I'm still having some trouble understanding
this. My problem is, that everytime I get what I believe to be an error in a
lua script, the program exits, without issuing an error message at all. This
is using lua_call. Is this the correct behaviour? In 4.0, if I remember
correctly, a message was sent to stdout, or _ALERT. I suppose I should use
lua_pcall.

I'm trying to use loadfile, from lauxlib, but the only one I see is called
luaL_loadfile. Is this the same as the one indicated below? Also, is there a
reference for lauxlib somewhere? 

Thanks, Philip Bock

Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> said:

> >I've been porting over my software to the 5.0 beta. So far I like what I've
> >seen. However, I need to know more about where error messages and such are
> >sent by Lua. 4.0 had _ALERT, which I redirected to my own C function, such
> >that Lua error messages would be sent to my log system. The 5.0 reference
> >manual says nothing about _ALERT, and doesn't seem to offer an alternative. Is
> >there something I've missed?
> 
> There is no _ALERT in 5.0 because Lua 5.0 does not issue any error messages:
> it leaves them on the stack to be handled by the application as it sees fit.
> This scheme is simpler and more flexible. You have to check the return value
> of lua_load, lua_pcall, or lua_cpcall (see etc/min.c for a simple example).
> Or lua_loadfile or lua_loadstring if you're using them. For compatibility,
> there is still lua_dofile and lua_dostring, which will try to call _ALERT,
> but those 2 functions are for compatibility only.
> 
> Moreover, the standalone interpreter, lua.c, calls _TRACEBACK in case of errors.
> This functions receives an error message and the intention is that it
> reformats suitably and return the reformatted string, but _TRACEBACK can be
> used to catch errors (however, lua.c will still print some error message).
> --lhf
> 



--