lua-users home
lua-l archive

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


On Fri, Aug 24, 2012 at 5:51 AM, Jerome Vuarand
<jerome.vuarand@gmail.com> wrote:
> To show how it's unrelated to traceback, the following should show the
> name of your function:
>
> print(pcall(function() mylib.read(2) end))

Thanks, Jerome, that's it exactly.

I was wondering how I'd never noticed this all these years, and then
realized that our code almost always uses xpcall(), because we want
the stack trace to the error location, and that forces the use of an
anonymous function, so lua always knows the function name.

Cheers,
Sam