[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Load Compiled Script?
- From: "Wim Couwenberg" <w.couwenberg@...>
- Date: Wed, 30 Apr 2003 11:45:39 +0200
And yes... the globals (environment) thingy in Lua 5 pulled my leg once
again... :-P To execute the file in the proxy context replace that piece
of code in my previous mail with:
-- load and execute script file in proxy context
local f = loadfile(fname)
setfenv(f, proxy)
f()
(Tech note: loadfile changed in Lua 5.0 final. In 5.0 beta the loaded
chunk received the globals of the caller but now it receives the C globals,
i.e. the result of getfenv(0). Maybe because of the tail call issue?
However, dofile in Lua 5.0 beta already used the C globals so my original
code snippet wouldn't work in 5.0 beta either.)
Bye,
Wim