| 261 | |
| 262 | |
| 263 | static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, |
| 264 | Closure *f, CallInfo *ci) { |
| 265 | int status = 1; |
| 266 | for (; *what; what++) { |
| 267 | switch (*what) { |
| 268 | case 'S': { |
| 269 | funcinfo(ar, f); |
| 270 | break; |
| 271 | } |
| 272 | case 'l': { |
| 273 | ar->currentline = (ci && isLua(ci)) ? currentline(ci) : -1; |
| 274 | break; |
| 275 | } |
| 276 | case 'u': { |
| 277 | ar->nups = (f == NULL) ? 0 : f->c.nupvalues; |
| 278 | if (noLuaClosure(f)) { |
| 279 | ar->isvararg = 1; |
| 280 | ar->nparams = 0; |
| 281 | } |
| 282 | else { |
| 283 | ar->isvararg = f->l.p->is_vararg; |
| 284 | ar->nparams = f->l.p->numparams; |
| 285 | } |
| 286 | break; |
| 287 | } |
| 288 | case 't': { |
| 289 | ar->istailcall = (ci) ? ci->callstatus & CIST_TAIL : 0; |
| 290 | break; |
| 291 | } |
| 292 | case 'n': { |
| 293 | ar->namewhat = getfuncname(L, ci, &ar->name); |
| 294 | if (ar->namewhat == NULL) { |
| 295 | ar->namewhat = ""; /* not found */ |
| 296 | ar->name = NULL; |
| 297 | } |
| 298 | break; |
| 299 | } |
| 300 | case 'L': |
| 301 | case 'f': /* handled by lua_getinfo */ |
| 302 | break; |
| 303 | default: status = 0; /* invalid option */ |
| 304 | } |
| 305 | } |
| 306 | return status; |
| 307 | } |
| 308 | |
| 309 | |
| 310 | LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { |
no test coverage detected