Hey guys. I want to learn how to use Self but I not really understand the concept. This is a script founded on the lua.org page
Account = { balance=0, withdraw = function(self, v) self.balance = self.balance - v end } function Account:deposit(v) self.balance = self.balance + v end Account.deposit(Account, 200.00) Account:withdraw(100.00)
My question is, why if I change the lines 10, 11 the result is not same.
Account:deposit(Account, 200.00) Account.withdraw(100.00)
Error: Line 7 - Attempt to perform arithmetics on
I want to understand what is the (lovely) difference. I want updgrade my scripting skills x)