Lua script throws error "attempt to call a nil value (field 'deposit')"
<p>I have this Lua script, which is supposed to create a new class, create an instance and call functions, but there's an error in which I actually call the methods.</p>

<pre class="lang-lua prettyprint-override"><code>Account = {
    balance = 0,
    new = function(self,o)
        o = o or {}
        setmetatable(o,self)
        self.__index = self
        return o
    end,
    deposit = function(self,money)
        self.balance = self.balance +  money
    end,
    withdraw = function(self,money)
        self.balance = self.balance - money
    end

}
new_account = Account.new()
print(new_account.balance)
new_account.deposit(23)
new_account.deposit(1)
print(new_account.balance)
</code></pre>

<p>It keeps throwing this error:</p>

<pre><code>attempt to call a nil value (field 'deposit') 
</code></pre>

<p>It seems to work like this:</p>

<pre class="lang-lua prettyprint-override"><code>Account = {
    balance = 0,
}

function Account:new(o)
    o = o or {}
    setmetatable(o,self)
    self.__index = self
    return o
end

function Account:deposit(money)
    self.balance = self.balance + money
end

function Account:withdraw(money)
    self.balance = self.balance - money
end

function Account:get_balance()
    return self.balance
end


acc = Account:new({})

print(acc.balance)

acc:deposit(1920)

print(acc:get_balance())
</code></pre>

<p>I don't seem to get what's wrong. Maybe it's the ':' operator that only works?</p>