lua-users home
lua-l archive

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


Thanks for the explanation folks -- understood.  I had almost began thinking (and researching) along the lines of needing to declare metatables to enforce/enable arithmetic operation functionality for the tax table.


On Wed, Sep 18, 2013 at 6:04 PM, liam mail <liam.list@googlemail.com> wrote:
>So, there doesn't seem to be any issue in doing arithmetic with table fields !!
Correct there is not, although this is not what you are doing.

On 18 September 2013 13:18, Jayanth Acharya <jayachar88@gmail.com> wrote:
tax:init(12200, 12)

This is a self call which is sent three parameters not two, the first being the self instance ie a Table.
Your print statement also highlights this when you call print(tax:getIncome(), tax:getRate())
table: 0028CA00    12200


May I suggest you look at using metatables, possibly reading 16.1 in PiL 3rd edition or 4th edition, or maybe a wiki entry[1]