lua-users home
lua-l archive

Error messages

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


As you all know, chunks take a chunk name string thingy, and it can be "=<whatever>" if you want to customize the chunk name on error messages and stuff... What if you could make a function handle error message displaying?
Something like...
load(chunk, <stuff>, function(chunkName, lineNumber, errorData, lineData stackTraceback) return string.format("%s:%s: %s",chunkName,lineNumber+10,errorData) end)
and then the following chunk:
error("my error")
would print:
myChunk:11: my error
<stack traceback stuff>

AltStyle によって変換されたページ (->オリジナル) /