| 542 | |
| 543 | |
| 544 | static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { |
| 545 | Instruction i; |
| 546 | if ((isLua(ci) && ci->tailcalls > 0) || !isLua(ci - 1)) |
| 547 | return NULL; /* calling function is not Lua (or is unknown) */ |
| 548 | ci--; /* calling function */ |
| 549 | i = ci_func(ci)->l.p->code[currentpc(L, ci)]; |
| 550 | if (GET_OPCODE(i) == OP_CALL || GET_OPCODE(i) == OP_TAILCALL || |
| 551 | GET_OPCODE(i) == OP_TFORLOOP) |
| 552 | return getobjname(L, ci, GETARG_A(i), name); |
| 553 | else |
| 554 | return NULL; /* no useful name can be found */ |
| 555 | } |
| 556 | |
| 557 | |
| 558 | /* only ANSI way to check whether a pointer points to an array */ |
no test coverage detected