lua-users home
lua-l archive

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


If "company" is a local variable, you have its value on the stack. If it is global, you will need a table lookup to find it.

On Sun, Oct 11, 2020, 18:20 孙世龙 sunshilong <sunshilong369@gmail.com> wrote:
Hi, list

How many table accesses caused by this _expression_:

zip = company and company.director and
company.director.address and
company.director.address.zipcode

As per the book(programming in Lua, 4th edition), the answer is 6.
Why?
For 0+1+2+3?

Why "company" does not perform a table access?
Could somebody shed some light on this question?

Best regards.
Sunshilong