local data = {}
function data:__call(t)
assert(type(t) == "table", ("bad arg #1 table expected, got %s"):format(type(t)))
local t2 = t
local bindable = Instance.new("BindableEvent")
t = setmetatable({}, {
__index = t,
__newindex = function(self, index, value)
if t2[index] ~= value then
bindable:Fire(index, value)
rawset(t2, index, value) -- C stack overflow no more
end
end
})
t.Changed = bindable.Event
return t
end
return setmetatable(data, data)
How __newindex can detect self[index] += value
When I try it myself it gives me a error but this module is working but how?
Can you explain me please