lua-users home
lua-l archive

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


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