lua-users home
lua-l archive

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


> >If I see 'global', I assume that 'global' is what is meant. What do
> >you think of a name change to reflect what the function really does?
>
> Well, setglobal does set the table that resolves global names. I think the
> name is suitable, especially because it takes a function as its first arg.
> So setglobal(f,t) reads "now resolve global names in f using t". But of
> course tastes differ. You can always do "setenvironment=setglobals" ...
> --lhf

Well, i guess Gunnar's point was, that the name of the setglobals() function
suggests that it does what the Lua 4 setglobals did (a global change).
The new Lua 5 setglobals() isn't operating "globally" any more.

Maybe even the name of "global variables" is a bit misleading now,
considering that each function may have its own table for them. (Of course
in the most cases, there will still be only one global table.)

I think it would be good to describe this better in the reference manual.
(the explanation for "setglobals" is a bit short, considering the big change
from Lua 4 to Lua 5)

Cheers,
Peter Prade