Problem with metatable

output says:
Workspace.S2:5: attempt to perform arithmetic (mul) on table and number
script analysis says:
W000: (17,7) Type ‘{ @metatable: metatable, d }’ could not be converted into ‘number’

W000: (17,11) Argument count mismatch. Function expects 2 arguments, but 3 are specified

my script:

local  d = {g = 2}

local metatable = {
	__call = function(a:number,b:number)
		return a*b
	end,
	
	
}






 setmetatable(d,metatable)
print(d(2,4))

Hey! The first argument that is given to the function will be the table itself, so, you need to accept that as the first argument. So your script should look like this:

local d = {g = 2}

local metatable = {
	__call = function(self, a:number,b:number)
		-- self = d
		return a*b
	end,
}

setmetatable(d,metatable)
print(d(2,4))
1 Like