lua-users home
lua-l archive

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


Luiz Henrique de Figueiredo wrote:

> >Is there some limit that we aren't aware of?  Stacks,
> >global namespaces, etc.?
>
> There are no limits on the number of times dofile may
> be executed.

As a side note to the above, although it looks like you can call dofile()
as many times as you want sequentially, I think there is a potential limit
on the number of *nested* dofile() calls.  Here's a portion of the code at
the end of lua_dofile() in Lua 4.0:

  luaZ_Fopen(&z, f, source);
  status = do_main(L, &z, bin);
  if (f != stdin)
    fclose(f);

During the time that do_main() is executed, the file handle f is open.  If
there are nested do_file() calls, then the user will be limited by number
of open files the operating system provides.  This doesn't seem to be the
case for the problem described above, but is a limit you may want to either
document as system dependent or remove by reading the whole file in as a
string and closing the file prior to do_main().