| 330 | |
| 331 | |
| 332 | static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, |
| 333 | Closure *f, CallInfo *ci) { |
| 334 | int status = 1; |
| 335 | for (; *what; what++) { |
| 336 | switch (*what) { |
| 337 | case 'S': { |
| 338 | funcinfo(ar, f); |
| 339 | break; |
| 340 | } |
| 341 | case 'l': { |
| 342 | ar->currentline = (ci && isLua(ci)) ? getcurrentline(ci) : -1; |
| 343 | break; |
| 344 | } |
| 345 | case 'u': { |
| 346 | ar->nups = (f == NULL) ? 0 : f->c.nupvalues; |
| 347 | if (noLuaClosure(f)) { |
| 348 | ar->isvararg = 1; |
| 349 | ar->nparams = 0; |
| 350 | } |
| 351 | else { |
| 352 | ar->isvararg = f->l.p->is_vararg; |
| 353 | ar->nparams = f->l.p->numparams; |
| 354 | } |
| 355 | break; |
| 356 | } |
| 357 | case 't': { |
| 358 | ar->istailcall = (ci) ? ci->callstatus & CIST_TAIL : 0; |
| 359 | break; |
| 360 | } |
| 361 | case 'n': { |
| 362 | ar->namewhat = getfuncname(L, ci, &ar->name); |
| 363 | if (ar->namewhat == NULL) { |
| 364 | ar->namewhat = ""; /* not found */ |
| 365 | ar->name = NULL; |
| 366 | } |
| 367 | break; |
| 368 | } |
| 369 | case 'r': { |
| 370 | if (ci == NULL || !(ci->callstatus & CIST_TRAN)) |
| 371 | ar->ftransfer = ar->ntransfer = 0; |
| 372 | else { |
| 373 | ar->ftransfer = ci->u2.transferinfo.ftransfer; |
| 374 | ar->ntransfer = ci->u2.transferinfo.ntransfer; |
| 375 | } |
| 376 | break; |
| 377 | } |
| 378 | case 'L': |
| 379 | case 'f': /* handled by lua_getinfo */ |
| 380 | break; |
| 381 | default: status = 0; /* invalid option */ |
| 382 | } |
| 383 | } |
| 384 | return status; |
| 385 | } |
| 386 | |
| 387 | |
| 388 | LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { |
no test coverage detected