lua_getinfo
lua_getinfo(L1, "Slnt", &ar);
lua_getinfo(L, "n", &ar);
lua_getinfo(L, "Sl", &ar); /* get info about it */
lua_getinfo(L, "f", ar); /* push function */
LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar);