lua-users home
lua-l archive

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


> 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