| 4738 | |
| 4739 | |
| 4740 | LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { |
| 4741 | int status; |
| 4742 | Closure *f = NULL; |
| 4743 | CallInfo *ci = NULL; |
| 4744 | lua_lock(L); |
| 4745 | if (*what == '>') { |
| 4746 | StkId func = L->top - 1; |
| 4747 | luai_apicheck(L, ttisfunction(func)); |
| 4748 | what++; /* skip the '>' */ |
| 4749 | f = clvalue(func); |
| 4750 | L->top--; /* pop function */ |
| 4751 | } |
| 4752 | else if (ar->i_ci != 0) { /* no tail call? */ |
| 4753 | ci = L->base_ci + ar->i_ci; |
| 4754 | lua_assert(ttisfunction(ci->func)); |
| 4755 | f = clvalue(ci->func); |
| 4756 | } |
| 4757 | status = auxgetinfo(L, what, ar, f, ci); |
| 4758 | if (strchr(what, 'f')) { |
| 4759 | if (f == NULL) setnilvalue(L->top); |
| 4760 | else setclvalue(L, L->top, f); |
| 4761 | incr_top(L); |
| 4762 | } |
| 4763 | if (strchr(what, 'L')) |
| 4764 | collectvalidlines(L, f); |
| 4765 | lua_unlock(L); |
| 4766 | return status; |
| 4767 | } |
| 4768 | |
| 4769 | |
| 4770 | /* |
no test coverage detected