| 386 | |
| 387 | |
| 388 | LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { |
| 389 | int status; |
| 390 | Closure *cl; |
| 391 | CallInfo *ci; |
| 392 | TValue *func; |
| 393 | lua_lock(L); |
| 394 | if (*what == '>') { |
| 395 | ci = NULL; |
| 396 | func = s2v(L->top - 1); |
| 397 | api_check(L, ttisfunction(func), "function expected"); |
| 398 | what++; /* skip the '>' */ |
| 399 | L->top--; /* pop function */ |
| 400 | } |
| 401 | else { |
| 402 | ci = ar->i_ci; |
| 403 | func = s2v(ci->func); |
| 404 | lua_assert(ttisfunction(func)); |
| 405 | } |
| 406 | cl = ttisclosure(func) ? clvalue(func) : NULL; |
| 407 | status = auxgetinfo(L, what, ar, cl, ci); |
| 408 | if (strchr(what, 'f')) { |
| 409 | setobj2s(L, L->top, func); |
| 410 | api_incr_top(L); |
| 411 | } |
| 412 | if (strchr(what, 'L')) |
| 413 | collectvalidlines(L, cl); |
| 414 | lua_unlock(L); |
| 415 | return status; |
| 416 | } |
| 417 | |
| 418 | |
| 419 | /* |
no test coverage detected