[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luaL_argcheck doesn't know function name if debug.traceback isn't used?
- From: Sam Roberts <vieuxtech@...>
- Date: Fri, 24 Aug 2012 14:35:49 -0700
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