lua-users home
lua-l archive

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

On Sat, 23 Feb 2002, David Jeske wrote:

> How about changing the machinery to bing the current "global table"
> for a function to a local variable of the function at definition time?
> The equivilant of writing:
>   function myfunc(a,b,c)
>     local _g = %GLOBALS;   -- all globals accessed
>     print(_g.test);        -- printing a global variable
>   end

If I understood your proposal, the correct translation for this function
should be:

      _g.print(_g.test);        -- printing a global variable

("print" is also a global variable, like all others...) So, if you
declare this function with a different global table, it will not find
the "print" function.

-- Roberto