lua-users home
lua-l archive

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


What do you mean by "abort"?

If you want to identify where a function throws an error, use:

lua_pcall() from C code

xpcall() from Lua code

Inside of the error handler use the lua debug functions to get line
number, file name, function name, etc.

See errorfb() in ldblib.c for an example in C.

See trace-calls.lua in the test directory of the Lua distribution for an
example in Lua.

-Kevin


> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br 
> [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of 
> Michael Newberry
> Sent: Monday, August 16, 2004 7:08 PM
> To: Lua list
> Subject: Finding line number of script abort
> 
> 
> When a script aborts, how can I identify the chunk and the 
> line number?Other
> info would be nice too, but at least these items would tell 
> me where the
> script stopped. In the book I found descriptions of using 
> line number hooks
> but I don;t think that is what I want to do.
> 
> Michael
>