lua中通过require导入的文件,最终都存在package.loaded这个table中。
require会判断是否文件已经加载避免重复加载同一文件
所以需要先把package.loaded中对应的内容置空,然后再重新导入
local reTab = {}
for key,val in pairs(package.loaded) do
if string.sub(key,1,4) == "app/" or string.sub(key,1,4) == "app." or key == "config" then
if key ~= "app/views/LoginScene" then
package.loaded[key] = nil
reTab[#reTab + 1] = key
--print("key<<",key)
end
end
end