lua-users home
lua-l archive

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

>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 <> 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]