[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Error source formatting
- From: Albert-Jan Brouwer <acj.brouwer@...>
- Date: Wed, 19 Nov 2003 12:19:10 +0100
I have been looking into customizing the formatting of errors.
The [string "<chunkname>"]:<linenumber> format is a little dense, and
the chunk is actually a file loaded by other means, so the mandatory
"string" prefix can be a little confusing to users. Moreover, it would be
include a stack trace.
I ended up replacing luaL_where() in lauxlib.c with something that
prints a nicely formatted stack trace. Unfortunately, that does not
cover compilation errors or errors thrown by the VM, such as trying to
call a nil function. Their formatting seems to be done somewhere down
in luaO_chunkid and a number of functions calling that. It does not
look like trying to customize the formatting is safe and maintainable
in the face of new Lua versions.
So I guess what I'm asking for is a pluggable/customizable means of
formatting errors when its comes to chunks/functions, linenumbers,
and stack traces... or is there some option I'm overlooking?