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