Hi guys, I am making a metatable so I know when something has changed and I can refresh on my table but for some reason it errors with;
Players.varjoy.PlayerGui.ScreenGui.Client:253: attempt to perform arithmetic (add) on nil and number
here’s a bit of code;
local RealIndex = 1;
local function refreshIndex()
print("REALINDEX;",RealIndex)
math.clamp(RealIndex,1,#Categories.getvalues())
end;
local Index = setmetatable({},{
__call = function(self,arg)
print("__call",arg)
RealIndex = arg
refreshIndex()
end,
__add = function(self,i)
print('__add',i)
RealIndex += 1
-- its set to nil!
refreshIndex()
end,
__sub = function(self,i)
print("__sub",i)
RealIndex -= 1
refreshIndex()
end,
});
Output;
![]()
But when I call again and i’m at 2:
Video;
