lua-users home
lua-l archive

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

>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.

You can give your own name to a chunk. The "string" prefix is only added
if you use the default name when loading the chunk. If you want it to
appear like a file, use "@xxx", where "xxx" is the file name. If you
want your own string, use "=xxx", and "xxx" will appear verbatim.

>Moreover, it would be include a stack trace.

The core does not add a stack trace. If you don't want one, simply
do not supply one when you call lua_pcall. If you're using lua.c, then
simply set _TRACEBACK to the identity function:
	_TRACEBACK = function (x) return x end

>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?

The last argument in lua_pcall is there for this. Perhaps I'm missing