Re: dofile semantics
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: dofile semantics
- From: Lisa Parratt <lisa@...>
- Date: Sat, 7 Jan 2006 11:14:03 +0000
I was under the impression dofile was meant to behave as though the
supplied file ad been entered at an interpreter prompt, rather than
loaded and executed as a chunk?
On 7 Jan 2006, at 10:22, CHU Run-min wrote:
The standard dofile executes the lua chunk in the global environment.
I think it should be in the environment of the caller of dofile.
See the following:
local std_loadfile=loadfile
function dofile(filename)
local func=assert(std_loadfile(filename))
setfenv(func,getfenv(2))
func()
end