lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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