From a23eab388cd3d257a36edd1a784dc17e62d79e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 18 Jun 2021 20:00:54 +0800 Subject: gc param --- script/vm/vm.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'script') diff --git a/script/vm/vm.lua b/script/vm/vm.lua index a9c788fc..b2f420df 100644 --- a/script/vm/vm.lua +++ b/script/vm/vm.lua @@ -10,7 +10,7 @@ local log = log local xpcall = xpcall local mathHuge = math.huge -local weakValueMT = { __mode = 'v' } +local weakMT = { __mode = 'kv' } _ENV = nil @@ -106,7 +106,7 @@ function m.mergeResults(a, b) return a end -m.cacheTracker = setmetatable({}, weakValueMT) +m.cacheTracker = setmetatable({}, weakMT) function m.flushCache() if m.cache then @@ -115,7 +115,7 @@ function m.flushCache() m.cacheVersion = files.globalVersion m.cache = {} m.cacheActiveTime = mathHuge - m.locked = setmetatable({}, weakValueMT) + m.locked = setmetatable({}, weakMT) m.cacheTracker[m.cache] = true end @@ -125,7 +125,7 @@ function m.getCache(name, weak) end m.cacheActiveTime = timer.clock() if not m.cache[name] then - m.cache[name] = weak and setmetatable({}, weakValueMT) or {} + m.cache[name] = weak and setmetatable({}, weakMT) or {} end return m.cache[name] end -- cgit v1.2.3