mirror of
https://github.com/TangentFoxy/lurker.git
synced 2025-07-28 02:52:18 +00:00
Moved hotswap code to lurker.hotswapfile()
This commit is contained in:
41
lurker.lua
41
lurker.lua
@@ -174,27 +174,30 @@ function lurker.exiterrorstate()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function lurker.scan()
|
function lurker.hotswapfile(f)
|
||||||
for _, f in pairs(lurker.getchanged()) do
|
lurker.print("Hotswapping '{1}'...", {f})
|
||||||
lurker.print("Hotswapping '{1}'...", {f})
|
if lurker.state == "error" then
|
||||||
if lurker.state == "error" then
|
lurker.exiterrorstate()
|
||||||
lurker.exiterrorstate()
|
end
|
||||||
end
|
lurker.preswap(f)
|
||||||
lurker.preswap(f)
|
local modname = lurker.modname(f)
|
||||||
local modname = lurker.modname(f)
|
local t, ok, err = lume.time(lume.hotswap, modname)
|
||||||
local t, ok, err = lume.time(lume.hotswap, modname)
|
if ok then
|
||||||
if ok then
|
lurker.print("Swapped '{1}' in {2} secs", {f, t})
|
||||||
lurker.print("Swapped '{1}' in {2} secs", {f, t})
|
else
|
||||||
else
|
lurker.print("Failed to swap '{1}' : {2}", {f, err})
|
||||||
lurker.print("Failed to swap '{1}' : {2}", {f, err})
|
end
|
||||||
end
|
lurker.resetfile(f)
|
||||||
lurker.resetfile(f)
|
lurker.postswap(f)
|
||||||
lurker.postswap(f)
|
if lurker.protected then
|
||||||
if lurker.protected then
|
lurker.updatewrappers()
|
||||||
lurker.updatewrappers()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function lurker.scan()
|
||||||
|
lume.each(lurker.getchanged(), lurker.hotswapfile)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
return lurker.init()
|
return lurker.init()
|
||||||
|
Reference in New Issue
Block a user