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