From 58821a6921dd41ce5f8d6026bcbb499a64beac36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=B8=EC=A0=A4=EA=B7=80=20=EA=B3=A0=EC=96=91=EC=9D=B4?= =?UTF-8?q?=EB=93=A4?= <46598063+qwreey75@users.noreply.github.com> Date: Sat, 19 Feb 2022 20:09:10 +0900 Subject: [PATCH] inner reg refer fixing --- src/class.lua | 4 ++++ src/store.lua | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/src/class.lua b/src/class.lua index 026458f..beebe56 100644 --- a/src/class.lua +++ b/src/class.lua @@ -117,9 +117,13 @@ function module.init(shared) end local tween = value.tvalue; local from = value.fvalue; + local add = value.avalue; -- adding event function local function regFn(_,newValue,key) + if add then + newValue = newValue + add; + end if from then newValue = from[newValue]; end diff --git a/src/store.lua b/src/store.lua index d0eb64d..663bfec 100644 --- a/src/store.lua +++ b/src/store.lua @@ -110,6 +110,9 @@ function module.init(shared) from = function (s,value) return setmetatable({fvalue = value},{__index = s}); end; + add = function (s,value) + return setmetatable({avalue = value},{__index = s}); + end; }; registerClass.__index = registerClass; @@ -133,6 +136,10 @@ function module.init(shared) end end function store:__call(key,func) + local last = self.__self[key]; + if last and type(last) == "table" and getmetatable(last) == registerClass then + return last; + end local register = self.__reg[key]; if not register then register = setmetatable({