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