lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I had forgotten about "..."
After thinking about it, I prefer dofile(f,path)
However one could cover all bases and allow
dofile(f, path, ...) 

One of the things that has always annoyed me about dofile()/loadfile was how
to  request the load of a script from the same location as the file that is
invoking the dofile()/loadfile(). (Current directory is not an
applicable concept
on some systems). Lua 5.1 with the aid of package.path would seem to 
largely resolve this issue. Hence methinks dofile(f,path)

>         loadfile(f,path)(a1,a2,a3)
> directly (and be clear about it).
I agree.

thanks for this.
DB
 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> Now that 5.1 allows access to unnamed varargs via "...", you may argue that
> it'd be better to map
>         dofile(f,a1,a2,a3)
> into
>         loadfile(f)(a1,a2,a3)
> 
> But perhaps it'd be simpler to just do as you suggest -- people needing
> to pass arguments to chunks could use
>         loadfile(f,path)(a1,a2,a3)
> directly (and be clear about it).
> 
> --lhf
>