lua-users home
lua-l archive

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



On 22 Oct 2013 16:38, "Robert Virding" <robert.virding@erlang-solutions.com> wrote:
>
> Is it possible to re-require a module? The documentation implies that it is not possible as if the module has been loaded then it will be remembered in the package.loaded table and the next time is it loaded then this value will be reused.
>
> The scenario I was thinking about is a long-lived application where you need to upgrade a module but don't want to take down the system as you will have a lot state which needs to be maintained.
>
> It would also be interesting to speculate how to handle multiple versions of a module in the same system. In one sense it would be easy if they were kept in different places but overwriting an existing one may be tricky.
>

Sure, you can change package.loaded or just write your own require. The difficult bits are on the application side but all the tools are there.

Justin