lua-users home
lua-l archive

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




On 3 August 2011 12:44, Dirk Laurie <dpl@sun.ac.za> wrote:
Lua 5.2 has subsumed the functionality of 'loadstring' into 'load',
but 'loadfile' is still there, because its argument is a filename,
i.e. also a string.

For 'load' there is now an optional 'env' argument, thus 'loadin'
has also been subsumed into 'load'.  But there is no such argument
for 'loadfile'.

Instead of adding functionality to 'loadfile', another way could
be to extend 'load' further to accept an opened file as argument,
i.e. the following would be equivalent:

   loadfile "xxx"
   load(io.open "xxx")

What is the main argument against this?

Dirk


Don't you think load _already_ has too many responsibilities ?

Liam