From 40f06fac9dbc6eca1243c9d45f50483781f278ff 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: Sun, 19 Dec 2021 01:16:26 +0900 Subject: [PATCH] Update class.lua --- src/class.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/class.lua b/src/class.lua index a73ebcc..464c7c4 100644 --- a/src/class.lua +++ b/src/class.lua @@ -91,11 +91,22 @@ function module.init(shared) item[index] = dset; end end - value.register(function (newValue,store) + local tween = value.tween; + + -- adding event function + local function regFn(newValue,store) if with then newValue = with(newValue,item,store); end item[index] = newValue; + end + value.register(regFn); + + -- this is using hacky of roblox instance + -- this is will keep reference from week table until + -- inscance got GCed + item:GetPropertyChangedSignal("ClassName"):Connect(function () + return regFn; end); elseif (valueType == "function" or valueType == "table") and bind(item,index,value,valueType) then -- connect event -- event binding @@ -275,4 +286,4 @@ function module.init(shared) return new; end -return module; \ No newline at end of file +return module;