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