Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class 'A'
- local this
- function A:Initialize()
- this = self
- self.value = 0
- end
- function A:DoMath()
- self.value = self.value + 1
- end
- function A:PrintValue()
- Print(self.value)
- end
- local a = A()
- a:Initialize()
- a:PrintValue() //output = 0
- a.value = 20
- a:PrintValue() //output = 20
- A.DoMath(a) //increment to 21
- a:DoMath() //increment to 22
- Print(ToString(a == this)) //output = true
- Print(a.value) //output = 22
- a:PrintValue() //output = 22
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement