Another error question

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Another error question

Steve Goodrich
Ok, I have the error function thing working. Is there a way to get the
error message or some info about the error while I am in my error
handler? I have looked on the top of the stack but I didn't see anything
that looked useful.

Any suggestions?

Steve.

Reply | Threaded
Open this post in threaded view
|

Re: Another error question

Maria das Dores
>Ok, I have the error function thing working. Is there a way to get the
>error message or some info about the error while I am in my error
>handler? I have looked on the top of the stack but I didn't see 
anything
>that looked useful.
>
>Any suggestions?

Yes, read the manual, section 4.9.

MdD



______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

Reply | Threaded
Open this post in threaded view
|

Re: Another error question

Stephan Herrmann-2
"Maria das Dores" <[hidden email]> writes:

> >Ok, I have the error function thing working. Is there a way to get the
> >error message or some info about the error while I am in my error
> >handler? I have looked on the top of the stack but I didn't see 
> anything
> >that looked useful.
> >
> >Any suggestions?
> 
> Yes, read the manual, section 4.9.
> 
Ok, just inspecting the error message is no problem, but what if you
want to look at the context of the error?
Function lua_printstack() from iolib.c (now liolib.c) shows how to get
detailed information about the current callstack.
This function seems very usefull for the use by custom error-handlers.

Is there a reason, why lua_printstack() is not exported?

Stephan

--------------------------------------------------------------------------
 Stephan Herrmann
 ----------------
 Technical University Berlin
 Software Engineering Research Group
 http://swt.cs.tu-berlin.de/~stephan
 phone: ++49 30 314 73174         
--------------------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: Another error question

Maria das Dores
In reply to this post by Steve Goodrich
>
>Is there a reason, why lua_printstack() is not exported?
>

Function lua_printstack() does not need to be exported
since it's build using Lua Debug API (lua_stackedfunction,
lua_funcinfo and lua_getobjname). These functions can be
found on the manual, section 7.1.

Therefore, you can copy this function and make all changes
necessary to fit your particular application.

Regards,

MdD


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

Reply | Threaded
Open this post in threaded view
|

Re: Another error question

Roberto Ierusalimschy
> Function lua_printstack() does not need to be exported
> since it's build using Lua Debug API (lua_stackedfunction,
> lua_funcinfo and lua_getobjname). These functions can be
> found on the manual, section 7.1.

If we follow this, there would be no standard libraries (all functions defined there
can be defined through the API).

  The problem with lua_printstack is that we couldn't find a way to make
it really generic... For instance, in a Windows environment, with error
messages going to a "message box", it is of little use "lua_printstack" writing
to a file. Not exporting it gives us freedom to change this function when/if we
find a better way to write it.

-- Roberto