[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Re-requiring modules
- From: Thijs Schreijer <thijs@...>
- Date: Wed, 23 Oct 2013 06:29:46 +0000
> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On
> Behalf Of Robert Virding
> Sent: woensdag 23 oktober 2013 0:53
> To: Lua mailing list
> Subject: Re: Re-requiring modules
>
> Yes, BUT NO. Well it shouldn't work. In the 5.2 manual description of
> package.loaded it says
>
> "package.loaded
>
> A table used by require to control which modules are already loaded. When
> you require a module modname and package.loaded[modname] is not false,
> require simply returns the value stored there.
>
> This variable is only a reference to the real table; assignments to this
> variable do not change the table used by require."
>
> Which seems to imply that these suggestions should not work. This is why I
> was asking as otherwise it is easy.
>
> Robert
>
Here's [1] a nice discussion on dynamic reloading/replacing code earlier this year (if you want to go beyond simply reloading a module)
Thijs
[1] http://lua-users.org/lists/lua-l/2013-03/msg00768.html