** Try to find a name for a function based on how it was called. */
| 662 | ** Try to find a name for a function based on how it was called. |
| 663 | */ |
| 664 | static const char *funcnamefromcall (lua_State *L, CallInfo *ci, |
| 665 | const char **name) { |
| 666 | if (ci->callstatus & CIST_HOOKED) { /* was it called inside a hook? */ |
| 667 | *name = "?"; |
| 668 | return "hook"; |
| 669 | } |
| 670 | else if (ci->callstatus & CIST_FIN) { /* was it called as a finalizer? */ |
| 671 | *name = "__gc"; |
| 672 | return "metamethod"; /* report it as such */ |
| 673 | } |
| 674 | else if (isLua(ci)) |
| 675 | return funcnamefromcode(L, ci_func(ci)->p, currentpc(ci), name); |
| 676 | else |
| 677 | return NULL; |
| 678 | } |
| 679 | |
| 680 | /* }====================================================== */ |
| 681 |
no test coverage detected