Re: Problem with OOP in lua
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Problem with OOP in lua
- From: "Aaron Brown" <arundelo@...>
- Date: 2006年4月13日 09:46:56 -0400
bean wrote:
but there is a problem. if the balance is not a number,
it's a table,
If objects share tables, then they will reflect each others
changes. This means that new() needs to create all tables
(two, in your problem case) needed by the new object. For
example, you could change new's first line to:
o = o or {balance = {0}}
--
Aaron