volatile modules

Use dofile with file name to process file.

Using require makes module names independent from extension, but it creates reference in package.loaded['module_name'] table. Reference is created after loading module, so reference can be destroyed only later, by call

package.loaded['module_name'] = nil

One method is to provide module constructor

local M = {}
function M.init()
  package.loaded['module_name'] = nil
  ...
end
 
return M