Fixed lume.hotswap() to handle nonexistent modules properly

This commit is contained in:
rxi 2014-03-04 12:35:35 +00:00
parent fb64932134
commit dcc08346a2

View File

@ -263,7 +263,7 @@ function lume.hotswap(modname)
if type(v) == "table" then update(old[k], v) else old[k] = v end if type(v) == "table" then update(old[k], v) else old[k] = v end
end end
end end
local oldmod = require(modname) local oldmod = pcall(require, modname) or nil
local err = nil local err = nil
local function onerror(e) local function onerror(e)
for k, v in pairs(_G) do _G[k] = oldglobal[k] end for k, v in pairs(_G) do _G[k] = oldglobal[k] end