On the devforum, I see that programs typically use something like this:
function CameraModule:LockMouse() if self.activeCameraController then local mouseLockOffset = self.activeMouseLockController:GetMouseLockOffset() self.activeCameraController:SetIsMouseLocked(true) self.activeCameraController:SetMouseLockOffset(mouseLockOffset*3) end end --This is just an example of someone using the 'self' thing.
If you see this, there is a thing called self
. What is self
, and what are the practical uses of using self in functions like this?
Any help is appreciated!
https://devforum.roblox.com/t/what-is-self-and-how-can-i-use-it/368697
Now to answer your question, we use self as a way to access the previous argument called in the function, without passing the argument explicitly. self is notably used in Object Oriented Programming Implementation in Lua.