Suraj J wrote: > I am bumping into this stack trace issue when using luajit for the Lua > embedding in C application. You're using a tail call to a C function. Lua doesn't really do tail calls to C functions -- under the hood it's a regular call. But LuaJIT does: it always replaces the current stack frame for a tail call, no matter whether you call a Lua or a C function. Since function objects do not have a name in Lua, their names have to be inferred from the calling environment. This mechanism may come up with 'interesting' results for tail calls, since the actual calling frame is gone. But if you think it through, it's logical that it attributes the function with the name that the caller of the caller used. If you don't like this behavior for debugging purposes, you can suppress tail calls with extra parentheses: return (func(1, 2, 3)) --Mike