[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Re-requiring modules
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 22 Oct 2013 14:16:59 -0200
> Is it possible to re-require a module?
function rerequire(m)
package.loaded[m] = nil
return require(m)
end
or if your module sets a global:
function rerequire(m)
package.loaded[m] = nil
_G[m] = nil
_G[m] = require(m)
return _G[m]
end
Search lua-l archive for unrequire. See for instance
http://lua-users.org/lists/lua-l/2012-12/msg00883.html