| 265 | |
| 266 | |
| 267 | LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { |
| 268 | int status; |
| 269 | Closure *cl; |
| 270 | CallInfo *ci; |
| 271 | StkId func; |
| 272 | lua_lock(L); |
| 273 | if (*what == '>') { |
| 274 | ci = NULL; |
| 275 | func = L->top - 1; |
| 276 | api_check(ttisfunction(func), "function expected"); |
| 277 | what++; /* skip the '>' */ |
| 278 | L->top--; /* pop function */ |
| 279 | } |
| 280 | else { |
| 281 | ci = ar->i_ci; |
| 282 | func = ci->func; |
| 283 | lua_assert(ttisfunction(ci->func)); |
| 284 | } |
| 285 | cl = ttisclosure(func) ? clvalue(func) : NULL; |
| 286 | status = auxgetinfo(L, what, ar, cl, ci); |
| 287 | if (strchr(what, 'f')) { |
| 288 | setobjs2s(L, L->top, func); |
| 289 | api_incr_top(L); |
| 290 | } |
| 291 | if (strchr(what, 'L')) |
| 292 | collectvalidlines(L, cl); |
| 293 | lua_unlock(L); |
| 294 | return status; |
| 295 | } |
| 296 | |
| 297 | |
| 298 | /* |
no test coverage detected