| 275 | |
| 276 | |
| 277 | LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { |
| 278 | int status; |
| 279 | Closure *cl; |
| 280 | CallInfo *ci; |
| 281 | StkId func; |
| 282 | lua_lock(L); |
| 283 | swapextra(L); |
| 284 | if (*what == '>') { |
| 285 | ci = NULL; |
| 286 | func = L->top - 1; |
| 287 | api_check(L, ttisfunction(func), "function expected"); |
| 288 | what++; /* skip the '>' */ |
| 289 | L->top--; /* pop function */ |
| 290 | } |
| 291 | else { |
| 292 | ci = ar->i_ci; |
| 293 | func = ci->func; |
| 294 | lua_assert(ttisfunction(ci->func)); |
| 295 | } |
| 296 | cl = ttisclosure(func) ? clvalue(func) : NULL; |
| 297 | status = auxgetinfo(L, what, ar, cl, ci); |
| 298 | if (strchr(what, 'f')) { |
| 299 | setobjs2s(L, L->top, func); |
| 300 | api_incr_top(L); |
| 301 | } |
| 302 | swapextra(L); |
| 303 | if (strchr(what, 'L')) |
| 304 | collectvalidlines(L, cl); |
| 305 | lua_unlock(L); |
| 306 | return status; |
| 307 | } |
| 308 | |
| 309 | |
| 310 | /* |
no test coverage detected