[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: loadfile in lua 5 alpha
- From: Vincent Penne <ziggy@...>
- Date: Wed, 27 Nov 2002 13:49:51 +0100
I would indeed expect it to inherit from the caller, to be more similar
with a normal function declaration. But it is a detail since doing
setglobals works very well ...
By the way, congratulation for bringing to us such a wonderful language !
Roberto Ierusalimschy wrote:
I have remarked an unexpected behaviour (to me) of the lua loadfile
function. It returns a function, but it seems this function does not
herit the global table from the caller of the loadfile function. Is it
on purpose ? Which global table is assigned to it ?
Currently, loadfile (and loadstring) always returns a function with the
default global table (that is, the one used by the C functions). It
is very easy to change it before running the chunk, so that all functions
created by the chunck already get the new table:
local f = loadfile"..."
But we can change that.