lua-users home
lua-l archive

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


loadfile/dofile do not use the io module. On some systems without mass
storage loadfile/dofile might be of interest even if io module is not
implemented. Also, and that's probably a better reason, on very memory
constrained environments, it may be necessary to be able to load
scripts from files without having to load the full io module. This
makes porting Lua to such systems much simpler since you don't have to
implement the full io module to have a fully functionnal interpreter
with script loading.

I think bridging io (or any user defined input/output module) with
loadstring is very easy, and if it suits your project better you can
undefine loadfile/dofile.

To sum up my point of view, I think loadfile/dofile are not part of
file I/O but rather a part of a very basic lua core functionnality,
and as such should be seperate from io module.

2006/11/10, David Burgess <dburgess@gmail.com>:
Does it make sense to anybody else that Luas file IO should
be centalized around the io library()?

The exceptions are:

lua side - loadfile() and dofile().
Should these be file:load() and file:do() or io.load() and io.do() ?

C side -
luaL_loadfile() in lauxlib.c
and
readable() in loadlib.c

I think it would be nice if these exceptions did not exist.

Porting to Lua to systems with different file systems (or multiple file
systems) identifies these exceptions as a pain point. Anyone ideas
for improving this?

db