| 320 | |
| 321 | |
| 322 | LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar) { |
| 323 | int status; |
| 324 | Closure *cl; |
| 325 | CallInfo *ci; |
| 326 | StkId func; |
| 327 | lua_lock(L); |
| 328 | swapextra(L); |
| 329 | if (*what == '>') { |
| 330 | ci = nullptr; |
| 331 | func = L->top - 1; |
| 332 | api_check(L, ttisfunction(func), "function expected"); |
| 333 | what++; /* skip the '>' */ |
| 334 | L->top--; /* pop function */ |
| 335 | } |
| 336 | else { |
| 337 | ci = ar->i_ci; |
| 338 | func = ci->func; |
| 339 | lua_assert(ttisfunction(ci->func)); |
| 340 | } |
| 341 | cl = ttisclosure(func) ? clvalue(func) : nullptr; |
| 342 | status = auxgetinfo(L, what, ar, cl, ci); |
| 343 | if (strchr(what, 'f')) { |
| 344 | setobjs2s(L, L->top, func); |
| 345 | api_incr_top(L); |
| 346 | } |
| 347 | swapextra(L); /* correct before option 'L', which can raise a mem. error */ |
| 348 | if (strchr(what, 'L')) |
| 349 | collectvalidlines(L, cl); |
| 350 | lua_unlock(L); |
| 351 | return status; |
| 352 | } |
| 353 | |
| 354 | |
| 355 | /* |
no test coverage detected