lua-users home
lua-l archive

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


Hi,

I can't understand well environments and so the function getfenv.
For example we have :

env1=getfenv(1)
do
    local aa="bb"
    env2=getfenv(1)
    local cc="dd"
    local f = function() end
    env3=getfenv(f)
end

will env2 :
- be the same as env1 since it inehrit from env1 ? (so won't contain
neither aa or cc)
- be a table with feilds from env1 plus aa (and cc ?) ?
- be a table with just aa (and cc ?) ?
- be a table with just aa (and cc ?) ? but with his
metatable(env2).__index = env1
sames questions for env3

I made that test and I found that env2 doesn't contains neither aa not
cc .... Why ? The same for env3

I know I ask many questions ... But I don't understand how it works ...
maybe a chance to improve lua's documentation.

Mildred

-- 
<http://louve.dyndns.org> ou <http://mildred632.free.fr>
Le courrier E-mail est une correspondance privée. Merci de vous y conformer


Attachment: signature.asc
Description: OpenPGP digital signature