From 66cda74ccfc5f2e895e5ea982698655e16b47c81 Mon Sep 17 00:00:00 2001 From: Colby Klein Date: Sun, 1 Mar 2015 21:05:13 -0800 Subject: [PATCH] Add a mechanism to stop a hotswap from occurring. This comes in handy when certain files need to be swapped with some other mechanism (for example - files which must be loaded into a specific environment). To stop a swap, return true from lurker.preswap. Does not break any existing usage of preswap. --- lurker.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lurker.lua b/lurker.lua index 4d8e198..ae5c535 100644 --- a/lurker.lua +++ b/lurker.lua @@ -210,7 +210,11 @@ function lurker.hotswapfile(f) if lurker.state == "error" then lurker.exiterrorstate() end - lurker.preswap(f) + if lurker.preswap(f) then + lurker.print("Hotswap of '{1}' aborted by preswap'", {f}) + lurker.resetfile(f) + return + end local modname = lurker.modname(f) local t, ok, err = lume.time(lume.hotswap, modname) if ok then