/* Find a variable with the given name 'n'. If it is an upvalue, add this upvalue into all intermediate functions. If it is a global, set 'var' as 'void' as a flag.  */
static void singlevaraux(FuncState *fs, TString *n, expdesc *var, int base)
/* Find a variable with the given name 'n'. If it is an upvalue, add this upvalue into all intermediate functions. If it is a global, set 'var' as 'void' as a flag.  */
static void singlevaraux(FuncState *fs, TString *n, expdesc *var, int base)
{
    int v = searchvar(fs, n, var);
    if (v >= 0) {
      if (v == VLOCAL && !base)
        markupval(fs, var->u.var.vidx);
    }
    else {
      int idx = searchupvalue(fs, n);
      if (idx < 0) {
        singlevaraux(fs->prev, n, var, 0);
        if (var->k == VLOCAL || var->k == VUPVAL)
          idx  = newupvalue(fs, n, var);
        else
          return;
      }
      init_exp(var, VUPVAL, idx);
    }
  }
}