the ai couldnt give me an explanation, maybe you guys can give me one?
It’s mostly used in metatables
The keyword or variable self
is possibly used in metatables (especially __index
) or in colon “:
” methods.
local class = {}
class.Value = 2
function class:getValue() -- same as class.getValue(self)
return self.Value -- equivalent to `class.Value`
end