lua-users home
lua-l archive

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


>Could the dofile command be expanded to dofile(filename, table) and the
>table passed used as the global table for executing the file?

How about this:

function dofile(f,t)
 local globals=globals
 local g=globals(t)
 local rc=%dofile(f)
 globals(g)
 return rc
end

With a little more work, all values returned by dofile couldmbe returned too.
--lhf