From b8c5ab5dae0b826e576a9a99f92a7e63fb20fb01 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 29 Dec 2022 08:25:24 +0100 Subject: [PATCH] fix(cache): reload file if compiled code is incompatible. Fixes #225 --- lua/lazy/core/cache.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/lazy/core/cache.lua b/lua/lazy/core/cache.lua index f2daeee..b5075c0 100644 --- a/lua/lazy/core/cache.lua +++ b/lua/lazy/core/cache.lua @@ -158,7 +158,10 @@ function M.load(modkey, modpath) entry.used = os.time() if M.eq(entry.hash, hash) then -- found in cache and up to date - return loadstring(entry.chunk --[[@as string]], "@" .. entry.modpath) + local chunk, err = loadstring(entry.chunk --[[@as string]], "@" .. entry.modpath) + if not (err and err:find("cannot load incompatible bytecode", 1, true)) then + return chunk, err + end end else entry = { hash = hash, modpath = modpath, used = os.time() }