lua-users home
lua-l archive

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

If you want the name the function was called with, here's how Lua gets
it (and how you get those really nice argument error messages in C):


  lua_Debug ar;
  if (!lua_getstack(L, 0, &ar))  /* no stack frame? */ = "?"; /* Some default ? */
    lua_getinfo(L, "n", &ar);
    if ( == NULL) = "?"; /* <-- PUT DEFAULT HERE */

I think this is slow though? So perhaps you may want to avoid it
unless it is really necessary...

Hope that helps,

-Patrick Donnelly

"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."

-Will Durant