MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / getfuncname

Function getfuncname

third-party/lua-5.2.4/src/ldebug.c:462–498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

460
461
462static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) {
463 TMS tm;
464 Proto *p = ci_func(ci)->p; /* calling function */
465 int pc = currentpc(ci); /* calling instruction index */
466 Instruction i = p->code[pc]; /* calling instruction */
467 switch (GET_OPCODE(i)) {
468 case OP_CALL:
469 case OP_TAILCALL: /* get function name */
470 return getobjname(p, pc, GETARG_A(i), name);
471 case OP_TFORCALL: { /* for iterator */
472 *name = "for iterator";
473 return "for iterator";
474 }
475 /* all other instructions can call only through metamethods */
476 case OP_SELF:
477 case OP_GETTABUP:
478 case OP_GETTABLE: tm = TM_INDEX; break;
479 case OP_SETTABUP:
480 case OP_SETTABLE: tm = TM_NEWINDEX; break;
481 case OP_EQ: tm = TM_EQ; break;
482 case OP_ADD: tm = TM_ADD; break;
483 case OP_SUB: tm = TM_SUB; break;
484 case OP_MUL: tm = TM_MUL; break;
485 case OP_DIV: tm = TM_DIV; break;
486 case OP_MOD: tm = TM_MOD; break;
487 case OP_POW: tm = TM_POW; break;
488 case OP_UNM: tm = TM_UNM; break;
489 case OP_LEN: tm = TM_LEN; break;
490 case OP_LT: tm = TM_LT; break;
491 case OP_LE: tm = TM_LE; break;
492 case OP_CONCAT: tm = TM_CONCAT; break;
493 default:
494 return NULL; /* else no useful name can be found */
495 }
496 *name = getstr(G(L)->tmname[tm]);
497 return "metamethod";
498}
499
500/* }====================================================== */
501

Callers 1

auxgetinfoFunction · 0.70

Calls 2

currentpcFunction · 0.70
getobjnameFunction · 0.70

Tested by

no test coverage detected