[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How many table accesses caused by this expression?
- From: 孙世龙 sunshilong <sunshilong369@...>
- Date: Mon, 12 Oct 2020 09:49:22 +0800
>>
>> According to the context of the book, "company" is a global library,
>> like "math", "string" and so on.
>>
>> For details, see <<programming in Lua, 4th edition>> page 39.
>>
>Alright. After reviewing that section of the book, I think that it may
>either regard company as a local variable or regard the fact that
>global variables are looked up in a table as a detail irrelevant to
>the topic. Not sure which.
If I understand you correctly, the answer is 10 (i.e. 1+2+3+4) if it's
a global variable, whereas the answer is 6(i.e. 0+1+2+3) if it's a
local variable.
Am I right?
Please let me know if I miss something.
Thank you for your attention to my question.
Best regards
Sunshilong
On Sun, Oct 11, 2020 at 9:37 PM Robert Burke <sharpobject@gmail.com> wrote:
>
> On Sun, Oct 11, 2020 at 8:44 PM 孙世龙 sunshilong <sunshilong369@gmail.com> wrote:
> >
> > According to the context of the book, "company" is a global library,
> > like "math", "string" and so on.
> >
> > For details, see <<programming in Lua, 4th edition>> page 39.
> >
> Alright. After reviewing that section of the book, I think that it may
> either regard company as a local variable or regard the fact that
> global variables are looked up in a table as a detail irrelevant to
> the topic. Not sure which.