| 230 | |
| 231 | |
| 232 | LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { |
| 233 | int status; |
| 234 | Closure *f = NULL; |
| 235 | CallInfo *ci = NULL; |
| 236 | lua_lock(L); |
| 237 | if (*what == '>') { |
| 238 | StkId func = L->top - 1; |
| 239 | luai_apicheck(L, ttisfunction(func)); |
| 240 | what++; /* skip the '>' */ |
| 241 | f = clvalue(func); |
| 242 | L->top--; /* pop function */ |
| 243 | } |
| 244 | else if (ar->i_ci != 0) { /* no tail call? */ |
| 245 | ci = L->base_ci + ar->i_ci; |
| 246 | lua_assert(ttisfunction(ci->func)); |
| 247 | f = clvalue(ci->func); |
| 248 | } |
| 249 | status = auxgetinfo(L, what, ar, f, ci); |
| 250 | if (strchr(what, 'f')) { |
| 251 | if (f == NULL) setnilvalue(L->top); |
| 252 | else setclvalue(L, L->top, f); |
| 253 | incr_top(L); |
| 254 | } |
| 255 | if (strchr(what, 'L')) |
| 256 | collectvalidlines(L, f); |
| 257 | lua_unlock(L); |
| 258 | return status; |
| 259 | } |
| 260 | |
| 261 | |
| 262 | /* |
no test coverage detected