On 19.10.2012 12:45, Uli Schlachter wrote:
> However, without module(), the module doesn't get placed into a global
> variable.
> This means you have to do
>
> widgetfile = require("widgetfile")
>
> This is a good thing!
Full ACK, this is imho really the best solution.
> module() replaces the environment (_G) with a new, empty table. You could do
> the
> same directly with _G = {}. This new environment is accessible as _M. Because
> it
> is empty, nothing is accessible.
>
> However, local variables aren't resolved through the environment and thus stay
> accessible.
Ah, this is logical (even though I assume that the necessity of an empty
_G isn't given really often). And module being deprecated/disappearing
means _G won't disappear unless I do it explicitly?
> This is the end of today's lua course. Man, I know way too much about lua...
I'm glad that I was allowed to participate, thanks!
Manuel
--
To unsubscribe, send mail to [email protected].